def METHOD_NAME(self) -> Optional["subscriber.message.Message"]:
    """Gets a message from the on-hold queue. A message with an ordering
    key wont be returned if there's another message with the same key in
    flight.
    Returns:
        A message that hasn't been sent to the user yet or ``None`` if there are no
        messages available.
    """
    while self._messages_on_hold:
        msg = self._messages_on_hold.popleft()
        if msg.ordering_key:
            pending_queue = self._pending_ordered_messages.METHOD_NAME(msg.ordering_key)
            if pending_queue is None:
                # Create empty queue to indicate a message with the
                # ordering key is in flight.
                self._pending_ordered_messages[
                    msg.ordering_key
                ] = collections.deque()
                self._size = self._size - 1
                return msg
            else:
                # Another message is in flight so add message to end of
                # queue for this ordering key.
                pending_queue.append(msg)
        else:
            # Unordered messages can be returned without any
            # restrictions.
            self._size = self._size - 1
            return msg
    return None