def METHOD_NAME(buffer: bytearray) -> Optional[int]:
    """Receive the next incoming message on the message queue. Copies the message
    into ``buffer``, trimming the end of the message if necessary.
    Returns ``None`` if there are no pending messages, otherwise it returns the length
    of the message (which might be more than the length of the buffer).
    """