code: def _main(args, prog_name):
    
    # get options and arguments
    ui = getUI(prog_name, args)
  
    if ui.optionIsSet("test"):
      # just run unit tests
      unittest.main(argv=[sys.argv[0]])
    elif ui.optionIsSet("help"):
      # just show help
      ui.usage()
    else:
      verbose = ui.optionIsSet("verbose")
  
      # know there are exactly two arguments, because we specified this in the
      # UI description.
      regions_fn = ui.getArgument(0)
      to_count_fn = ui.getArgument(1)
  
      # get output handle
      out_fh = sys.stdout
      if ui.optionIsSet("output"):
        out_fh = open(ui.getValue("output"), "w")
  
      # norm?
      norm = ui.optionIsSet("normalize")
  
      # get anchor point
      anch = ANCHOR_START
      if ui.optionIsSet("anchor"):
        if ui.getValue("anchor") == "5-prime":
          anch = ANCHOR_5PRIME
  
      res = process_anchor_start(regions_fn, to_count_fn, anchor_to=anch,
                                 normalize=norm, verbose=verbose)
      write_output(res, out_fh, verbose=verbose)
docs: Process the command line arguments of this script and dispatch.