def METHOD_NAME(url, method, **kwargs):
    hostname = urllib.parse.urlparse(url).hostname
    access_token = get_zenodo_access_token(hostname)
    kwargs["params"] = {"access_token": access_token}
    r = getattr(requests, method)(url, **kwargs)
    if r.status_code == 401:
        print("The access token you provided is invalid.\n")
        keyring.delete_password("Zenodo", hostname)
        return METHOD_NAME(url, **kwargs)
    if r.status_code == 403:
        print(
            "The access token you provided doesn't appear to have the right scopes. "
            "Make sure that the access token you provide has the scopes "
            "`deposit:actions`, `deposit:write`, and `user:email`.\n"
        )
        keyring.delete_password("Zenodo", hostname)
        return METHOD_NAME(url, **kwargs)
    return r