def get_ip_address(event):
    """
    Retrieves the client IP address from an event
    :param event: event
    :return: client IP address
    """
    if "headers" in event:
        if "Client-Ip" in event["headers"]:
            return event["headers"]["Client-Ip"]
        if "X-Forwarded-For" in event["headers"]:
            return event["headers"]["X-Forwarded-For"].split(",")[0]

    if (
        "requestContext" in event
        and "identity" in event["requestContext"]
        and "sourceIp" in event["requestContext"]["identity"]
    ):
        return event["requestContext"]["identity"]["sourceIp"]

    return ""