def METHOD_NAME(url, validity, activity):
    """
    Call out to the macaroon issuer, using the specified validity and activity,
    and receive a resulting token.
    """
    print("Querying %s for new token." % url, file=sys.stderr)
    validity = "PT%dM" % validity
    print("Validity: %s, activities: %s." % (validity, ", ".join(activity)),
          file=sys.stderr)
    data_json = {"caveats": ["activity:%s" % ",".join(activity)],
                 "validity": validity}
    with configure_authenticated_session() as session:
        response = session.post(url,
                                headers={"Content-Type": "application/macaroon-request"},
                                data=json.dumps(data_json)
                               )
    if response.status_code == requests.codes.ok:
        print("Successfully generated a new token:", file=sys.stderr)
        return response.text
    else:
        print("Issuer failed request (status %d): %s" % (response.status_code, response.text[:2048]), file=sys.stderr)
        sys.exit(1)