docs: def _main():
      """
      Some demo.
      """
  
      if sys.argv[1:] == ["test"]:
          for k, v in sorted(globals().items()):
              if not k.startswith("test_"):
                  continue
              print("running: %s()" % k)
              v()
          print("ok.")
          sys.exit()
  
      elif sys.argv[1:] == ["debug_shell"]:
          debug_shell(locals(), globals())
          sys.exit()
  
      elif sys.argv[1:] == ["debug_shell_exception"]:
          try:
              raise Exception("demo exception")
          except Exception:
              better_exchook(*sys.exc_info(), debugshell=True)
          sys.exit()
  
      elif sys.argv[1:]:
          print("Usage: %s (test|...)" % sys.argv[0])
          sys.exit(1)
  
      # some examples
      # this code produces this output: https://gist.github.com/922622
  
      try:
          x = {1: 2, "a": "b"}
  
          # noinspection PyMissingOrEmptyDocstring
          def f():
              y = "foo"
              # noinspection PyUnresolvedReferences,PyStatementEffect
              x, 42, sys.stdin.__class__, sys.exc_info, y, z
          f()
      except Exception:
          better_exchook(*sys.exc_info())
  
      try:
          # noinspection PyArgumentList
          (lambda _x: None)(__name__,
                            42)  # multiline
      except Exception:
          better_exchook(*sys.exc_info())
  
      try:
          class Obj:
              def __repr__(self):
                  return (
                      "<Obj multi-\n" +
                      "     line repr>")
          obj = Obj()
          assert not obj
      except Exception:
          better_exchook(*sys.exc_info())
  
      # noinspection PyMissingOrEmptyDocstring
      def f1(a):
          f2(a + 1, 2)
  
      # noinspection PyMissingOrEmptyDocstring
      def f2(a, b):
          f3(a + b)
  
      # noinspection PyMissingOrEmptyDocstring
      def f3(a):
          b = ("abc" * 100) + "-interesting"  # some long demo str
          a(b)  # error, not callable
  
      try:
          f1(13)
      except Exception:
          better_exchook(*sys.exc_info())
  
      # use this to overwrite the global exception handler
      install()
      # and fail
      # noinspection PyUnresolvedReferences
      finalfail(sys)