def is_python_file(filename):
    """Return True if filename is Python file."""
    if filename.endswith('.py'):
        return True

    try:
        with open_with_encoding(filename) as f:
            first_line = f.readlines(1)[0]
    except (IOError, __HOLE__):
        return False

    if not PYTHON_SHEBANG_REGEX.match(first_line):
        return False

    return True
dataset/ETHPy150Open jdf/processing.py/mode/formatter/autopep8.py/is_python_file