<s> import os <EOL> def dupfile ( f , mode = None , buffering = <NUM_LIT:0> , raising = False ) : <EOL> """<STR_LIT>""" <EOL> try : <EOL> fd = f . fileno ( ) <EOL> except AttributeError : <EOL> if raising : <EOL> raise <EOL> return f <EOL> newfd = os . dup ( fd ) <EOL> mode = mode and mode or f . mode <EOL> return os . fdopen ( newfd , mode , buffering ) </s>
