def get_event_handler_parts(handler: EventHandler) -> tuple[str, str]:
    """Get the state and function name of an event handler.

    Args:
        handler: The event handler to get the parts of.

    Returns:
        The state and function name.
    """
    # Get the class that defines the event handler.
    parts = handler.fn.__qualname__.split(".")

    # Get the state full name
    state_full_name = handler.state_full_name

    # If there's no enclosing class, just return the function name.
    if not state_full_name:
        return ("", parts[-1])

    # Get the function name
    name = parts[-1]

    from reflex.state import State

    if state_full_name == FRONTEND_EVENT_STATE and name not in State.__dict__:
        return ("", to_snake_case(handler.fn.__qualname__))

    return (state_full_name, name)
Get the state and function name of an event handler.

    Args:
        handler: The event handler to get the parts of.

    Returns:
        The state and function name.
    
reflex/utils/format.py