Check file_to_parse for a shebang and return its components.

    :file_to_parse: can be either a filename or an open file object.

    If file_to_parse's extension exists in PATHEXT then an empty list
    will be returned, as it is assumed that the operating system knows
    how to handle files of this type. All other files will be opened
    and read.

def parse(file_to_parse):  # suppress(unused-function)
    """Check file_to_parse for a shebang and return its components.

    :file_to_parse: can be either a filename or an open file object.

    If file_to_parse's extension exists in PATHEXT then an empty list
    will be returned, as it is assumed that the operating system knows
    how to handle files of this type. All other files will be opened
    and read.
    """
    if hasattr(file_to_parse, "read"):
        return _parse(file_to_parse)
    elif isinstance(file_to_parse, six.string_types):
        if "PATHEXT" in os.environ:
            path_ext = os.environ["PATHEXT"].split(os.pathsep)
        else:
            path_ext = ()
        if os.path.splitext(file_to_parse)[1] in path_ext:
            return []

        with open(file_to_parse, "r") as fileobj:
            return _parse(fileobj)

    raise RuntimeError("""{} was not a file-like """
                       """object.""".format(repr(file_to_parse)))