def METHOD_NAME(self, policy):
    try:
        conn = boto3.Session(profile_name=self._profile_name).client('sts')
    except botocore.exceptions.ProfileNotFound as ecp:
        print('Warning: ', ecp)
        return None
    try:
        token = conn.get_federation_token(
            Name=self._name,
            Policy=json.dumps(policy),
            DurationSeconds=_FEDERATION_TOKEN_DURATION_SECONDS,
        )
        return token
    except botocore.exceptions.ClientError as ecp:
        print('Warning: ', ecp)
        return None