def METHOD_NAME(url, file_name=None):
    raw_target = url
    if not file_name:
        file_name = raw_target.split("/")[-1]
        file_name = urllib.parse.unquote(file_name)
    elif file_name not in ".":
        file_name = f"{file_name}.ipynb"
    file_name = f"{file_name}"
    if "://github.com" in raw_target:
        raw_target = raw_target.replace(
            "https://github.com/", "https://raw.githubusercontent.com/"
        )
        raw_target = raw_target.replace("/blob/", "/")
    content = b"ERROR"
    if "://" not in raw_target:
        try:
            cur_path = os.path.join(
                f"{n_env.path_naas_folder}{n_env.server_root}", raw_target
            )
            ff = open(cur_path, "rb")
            content = ff.read()
            ff.close()
        except Exception as e:
            print(f"Cannot open local file {cur_path}", e)
            content = (
                b"ERROR: Cannot open local file "
                + bytes(cur_path, "utf-8")
                + b" "
                + bytes(raw_target, "utf-8")
            )
    else:
        r = requests.get(raw_target)
        content = r.content
    if content.startswith(b"ERROR"):
        file_name = "dl_error.txt"
    file_name = __generate_unique_path(file_name)
    with open(file_name, "wb") as f:
        f.write(content)
        f.close()
    return file_name