code: def filter(self, msg_type=None, maxsize=0):
          
          if self._dead:
              return iter(())
          iterator = Handler._SBPQueueIterator(maxsize)
          # We use a weakref so that the iterator may be garbage collected if it's
          # consumer no longer has a reference.
          ref = weakref.ref(iterator)
          self._sinks.append(ref)
  
          def feediter(msg, **metadata):
              i = ref()
              if i is not None:
                  i(msg, **metadata)
              else:
                  raise Handler._DeadCallbackException
  
          self.add_callback(feediter, msg_type)
          return iterator
docs: Get a filtered iterator of messages for synchronous, blocking use in
          another thread.