code: def match_stream_handler(handler, streams=[]):
      
      return (isinstance(handler, logging.StreamHandler) and
              getattr(handler, 'stream') in (streams or (sys.stdout, sys.stderr)))
docs: Identify stream handlers writing to the given streams(s).
  
      :param handler: The :class:`~logging.Handler` class to check.
      :param streams: A sequence of streams to match (defaults to matching
                      :data:`~sys.stdout` and :data:`~sys.stderr`).
      :returns: :data:`True` if the handler is a :class:`~logging.StreamHandler`
                logging to the given stream(s), :data:`False` otherwise.
  
      This function can be used as a callback for :func:`find_handler()`.