def METHOD_NAME(filename: str) -> Tuple[str, bool]:
    """
    Search for a Mathics `filename` possibly adding extensions ".mx", or ".m"
    or as a file under directory PATH_VAR or as an Internet address.
    Return the resolved file name and True if this is a file in the
    a temporary file created, which happens for Internet addresses,
    or False if the file is a file in the filesystem.
    """
    # For names of the form "name`", search for name.mx and name.m
    is_temporary_file = False
    if filename[-1] == "`":
        filename = filename[:-1].replace("`", osp.sep)
        for ext in [".mx", ".m"]:
            result, is_temporary_file = METHOD_NAME(filename + ext)
            if result is not None:
                filename = None
                break
    if filename is not None:
        result = None
        # If filename is an Internet address, download the file
        # and store it in a tempory file
        lenfn = len(filename)
        if (
            (lenfn > 7 and filename[:7] == "http://")
            or (lenfn > 8 and filename[:8] == "https://")
            or (lenfn > 6 and filename[:6] == "ftp://")
        ):
            result = urlsave_tmp(filename)
            is_temporary_file = True
        else:
            for p in PATH_VAR + [""]:
                path = osp.join(p, filename)
                if osp.exists(path):
                    result = path
                    break
            # If `result` resolves to a dir, search within for Kernel/init.m and init.m
            if result is not None and osp.isdir(result):
                for ext in [osp.join("Kernel", "init.m"), "init.m"]:
                    tmp = osp.join(result, ext)
                    if osp.isfile(tmp):
                        return tmp, is_temporary_file
    return result, is_temporary_file