async def METHOD_NAME(messenger: Optional[BinaryMessenger]) -> RearPinState:
    """Returns the state of all IO GPIO pins on the rear panel."""
    current_state = RearPinState()
    if messenger is None:
        return current_state
    # estop port detection pins
    response = await messenger.send_and_receive(
        message=EstopButtonPresentRequest(),
        response_type=EstopButtonDetectionChange,
    )
    if response is not None:
        current_state.aux1_estop_det = bool(
            cast(EstopButtonDetectionChange, response).aux1_detected.value
        )
        current_state.aux2_estop_det = bool(
            cast(EstopButtonDetectionChange, response).aux2_detected.value
        )
    # Aux port detection pins
    response = await messenger.send_and_receive(
        message=AuxPresentRequest(),
        response_type=AuxPresentDetectionChange,
    )
    if response is not None:
        current_state.aux1_aux_det = bool(
            cast(AuxPresentDetectionChange, response).aux1_detected.value
        )
        current_state.aux2_aux_det = bool(
            cast(AuxPresentDetectionChange, response).aux2_detected.value
        )
    # Aux id pins
    response = await messenger.send_and_receive(
        message=AuxIDRequest(),
        response_type=AuxIDResponse,
    )
    if response is not None:
        current_state.aux1_id_active = bool(
            cast(AuxIDResponse, response).aux1_id_state.value
        )
        current_state.aux2_id_active = bool(
            cast(AuxIDResponse, response).aux2_id_state.value
        )
    # estop active pin
    response = await messenger.send_and_receive(
        message=EstopStateRequest(),
        response_type=EstopStateChange,
    )
    if response is not None:
        current_state.estop_active = bool(
            cast(EstopStateChange, response).engaged.value
        )
    # sync out pin
    response = await messenger.send_and_receive(
        message=SyncStateRequest(),
        response_type=SyncStateResponse,
    )
    if response is not None:
        current_state.sync_engaged = bool(
            cast(SyncStateResponse, response).engaged.value
        )
    # door state
    current_state.door_open = bool(await get_door_state(messenger))
    return current_state