code: def format_warning_oneline(message, category, filename, lineno,
                             file=None, line=None):
      
      # `warnings.formatwarning` produces multi-line output that does
      # not look good in a log file, so let us replace it with something
      # simpler...
      return ('{category}: {message}'
              .format(message=message, category=category.__name__))
docs: Format a warning for logging.
  
      The returned value should be a single-line string, for better
      logging style (although this is not enforced by the code).
  
      This methods' arguments have the same meaning of the
      like-named arguments from `warnings.formatwarning`.