def get_read_format(cls, source, args, kwargs):
ctx = None<EOL>if isinstance(source, FILE_LIKE):<EOL><INDENT>fileobj = source<EOL>filepath = source.name if hasattr(source, '<STR_LIT:name>') else None<EOL><DEDENT>else:<EOL><INDENT>filepath = source<EOL>try:<EOL><INDENT>ctx = get_readable_fileobj(filepath, encoding='<STR_LIT>')<EOL>fileobj = ctx.__enter__()  <EOL><DEDENT>except IOError:<EOL><INDENT>raise<EOL><DEDENT>except Exception:  <EOL><INDENT>fileobj = None<EOL><DEDENT><DEDENT>try:<EOL><INDENT>return get_format('<STR_LIT>', cls, filepath, fileobj, args, kwargs)<EOL><DEDENT>finally:<EOL><INDENT>if ctx is not None:<EOL><INDENT>ctx.__exit__(*sys.exc_info())<EOL><DEDENT><DEDENT>
Determine the read format for a given input source