docs: def create_logger(logger=None,
                    loglevel=None,
                    capture_warnings=True,
                    add_paramiko_handler=True):
      """
      Attach or create a new logger and add a console handler if not present
  
      Arguments:
  
          logger (Optional[logging.Logger]):
              :class:`logging.Logger` instance; a new one is created if this
              argument is empty
  
          loglevel (Optional[str or int]):
              :class:`logging.Logger`'s level, either as a string (i.e.
              ``ERROR``) or in numeric format (10 == ``DEBUG``)
  
              .. note:: a value of 1 == ``TRACE`` enables Tracing mode
  
          capture_warnings (boolean):
              Enable/disable capturing the events logged by the warnings module
              into ``logger``'s handlers
  
              Default: True
  
              .. note:: ignored in python 2.6
  
          add_paramiko_handler (boolean):
              Whether or not add a console handler for ``paramiko.transport``'s
              logger if no handler present
  
              Default: True
      Return:
          :class:`logging.Logger`
      """
      logger = logger or logging.getLogger(
          '{0}.SSHTunnelForwarder'.format(__name__)
      )
      if not any(isinstance(x, logging.Handler) for x in logger.handlers):
          logger.setLevel(loglevel or DEFAULT_LOGLEVEL)
          console_handler = logging.StreamHandler()
          _add_handler(logger,
                       handler=console_handler,
                       loglevel=loglevel or DEFAULT_LOGLEVEL)
      if loglevel:  # override if loglevel was set
          logger.setLevel(loglevel)
          for handler in logger.handlers:
              handler.setLevel(loglevel)
  
      if add_paramiko_handler:
          _check_paramiko_handlers(logger=logger)
  
      if capture_warnings and sys.version_info >= (2, 7):
          logging.captureWarnings(True)
          pywarnings = logging.getLogger('py.warnings')
          pywarnings.handlers.extend(logger.handlers)
      return logger