def get_best_encoding(stream):
rv = getattr(stream, '<STR_LIT>', None) or sys.getdefaultencoding()<EOL>if is_ascii_encoding(rv):<EOL><INDENT>return '<STR_LIT:utf-8>'<EOL><DEDENT>return rv<EOL>
Returns the default stream encoding if not found.