code: def _main():
      
      usage = "usage: %prog [options] cmd [arg] ..."
      optprs = OptionParser(usage=usage, version=version)
  
      optprs.add_option("--debug", dest="debug", default=False,
                        action="store_true",
                        help="Enter the pdb debugger on main()")
      optprs.add_option("--host", dest="host", metavar="HOST",
                        default="localhost", help="Connect to server at HOST")
      optprs.add_option("--port", dest="port", type="int",
                        default=9000, metavar="PORT",
                        help="Connect to server at PORT")
      optprs.add_option("--profile", dest="profile", action="store_true",
                        default=False,
                        help="Run the profiler on main()")
  
      (options, args) = optprs.parse_args(sys.argv[1:])
  
      # Are we debugging this?
      if options.debug:
          import pdb
  
          pdb.run('main(options, args)')
  
      # Are we profiling this?
      elif options.profile:
          import profile
  
          print("%s profile:" % sys.argv[0])
          profile.run('main(options, args)')
  
      else:
          main(options, args)
docs: Run from command line.