<s> import codecs <EOL> class LibdocOutput ( object ) : <EOL> def __init__ ( self , output_path , format ) : <EOL> self . _output_path = output_path <EOL> self . _format = format . upper ( ) <EOL> self . _output_file = None <EOL> def __enter__ ( self ) : <EOL> if self . _format == '<STR_LIT>' : <EOL> self . _output_file = codecs . open ( self . _output_path , '<STR_LIT:w>' , '<STR_LIT>' ) <EOL> return self . _output_file <EOL> return self . _output_path <EOL> def __exit__ ( self , * exc_info ) : <EOL> if self . _output_file : <EOL> self . _output_file . close ( ) </s>
