code: def custom_showwarning(
      message, category, filename="", lineno=-1, file=None, line=None
  ):
      
  
      if file is None:
          file = sys.stderr
          if file is None:
              # sys.stderr is None when run with pythonw.exe:
              # warnings get lost
              return
      text = "%s: %s\n" % (category.__name__, message)
      try:
          file.write(text)
      except OSError:
          # the file (probably stderr) is invalid - this warning gets lost.
          pass
docs: Hook to override default showwarning.
  
      https://stackoverflow.com/questions/2187269/python-print-only-the-message-on-warnings