from typing import Optional


def iam_user_id(event: dict) -> Optional[str]:
    """
    Returns the User ID (ARN) from IAM or None
    """

    try:
        return event["requestContext"]["identity"]["userArn"]
    except (TypeError, KeyError):
        return None