docs: def clear_synchronous_cb(self, cb):
          '''
          If the callback is the current expected callback, will clear it off the
          stack.  Else will raise in exception if there's an expectation but this
          doesn't satisfy it.
          '''
          if len(self._pending_events):
              ev = self._pending_events[0]
  
              # We can't have a strict check using this simple mechanism,
              # because we could be waiting for a synch response while messages
              # are being published. So for now, if it's not in the list, do a
              # check to see if the callback is in the pending list, and if so,
              # then raise, because it means we received stuff out of order.
              # Else just pass it through. Note that this situation could happen
              # on any broker-initiated message.
              if ev == cb:
                  self._pending_events.popleft()
                  self._flush_pending_events()
                  return ev
  
              elif cb in self._pending_events:
                  raise ChannelError(
                      "Expected synchronous callback %s, got %s", ev, cb)
          # Return the passed-in callback by default
          return cb