code: def main(method, add_args, version=None,
           docstring=None, error_stream=sys.stderr):
      
      if version:
          _versions.append(version)
      try:
          args = parse_args(
              add_args,
              docstring and docstring or '%s()' % method.__name__)
          return _exit_ok if method(args) else _exit_fail
      except KeyboardInterrupt as e:
          ctrl_c = 3
          return ctrl_c
      except SystemExit as e:
          return e.code
      except DebugExit:
          return _exit_fail
      except Exception as e:  # pylint: disable=broad-except
          if int(latest_version().split('.')[0]) < 1:
              raise
          if error_stream:
              print(e, file=error_stream)
          return _exit_fail
      return _exit_ok
docs: Run the method as a script
  
      Add a '--version' argument
      Call add_args(parser) to add any more
  
      Parse sys.argv
      call method(args)
      Catch any exceptions
          exit on SystemExit or KeyboardError
          Others:
              If version is less then 1, reraise them
              Else print them to the error stream