def METHOD_NAME():
    parameters = {"RoleArn": role_arn, "RoleSessionName": session_name}
    if external_id is not None:
        parameters['ExternalId'] = external_id
    credentials = retry(
        get_sts_client(
            session, region).assume_role, **parameters)['Credentials']
    return dict(
        access_key=credentials['AccessKeyId'],
        secret_key=credentials['SecretAccessKey'],
        token=credentials['SessionToken'],
        # Silly that we basically stringify so it can be parsed again
        expiry_time=credentials['Expiration'].isoformat())