class UserNotFound(Exception): ...


def get_user(access_token: str, *, idp_client) -> dict | None:
    """Gets the user attributes and metadata for a user."""
    try:
        user = idp_client.get_user(AccessToken=access_token)
    except idp_client.exceptions.ClientError:
        raise UserNotFound()
    else:
        return {attr['Name']: attr['Value'] for attr in user['UserAttributes']}
