def _supports_fileno(stream):
if hasattr(stream, '<STR_LIT>'):<EOL><INDENT>try:<EOL><INDENT>r = stream.fileno()<EOL>return True<EOL><DEDENT>except IOError:<EOL><INDENT>return False<EOL><DEDENT><DEDENT>else:<EOL><INDENT>return False<EOL><DEDENT>
Returns True if 'stream' supports the file descriptor and allows fileno().