import base64


def backend_internal_api_token(testconfig):
    """
    Returns the token for the internal api.
    The token is 'username: password' encoded in base64, where username and password
    are defined in the backend-internal-api secret
    """
    return base64.b64encode(
        f'{testconfig["threescale"]["backend_internal_api"]["username"].decode("ascii")}:'
        f'{testconfig["threescale"]["backend_internal_api"]["password"].decode("ascii")}'
        .encode("ascii")).decode("ascii")