def file(path_or_f):
    """
    Verifies that a file exists at a given path and that the file has a
    known extension type.

    :Parameters:
        path : `str`
            the path to a dump file

    """
    if hasattr(path_or_f, "readline"):
        return path_or_f
    else:
        path = path_or_f

    path = os.path.expanduser(path)
    if not os.path.isfile(path):
        raise FileTypeError(path % "Can't find file %s")

    match = EXT_RE.search(path)
    if match is None:
        raise FileTypeError("No extension found for %s." % path)
    elif match.groups()[0] not in EXTENSIONS:
        raise FileTypeError("File type %r is not supported." % path)
    else:
        return path
dataset/ETHPy150Open mediawiki-utilities/python-mediawiki-utilities/mw/xml_dump/functions.py/file/swapped operands of `%`