code: def run(
      main,
      argv=None,
      flags_parser=parse_flags_with_usage,
  ):
    
    try:
      args = _run_init(
          sys.argv if argv is None else argv,
          flags_parser,
      )
      while _init_callbacks:
        callback = _init_callbacks.popleft()
        callback()
      try:
        _run_main(main, args)
      except UsageError as error:
        usage(shorthelp=True, detailed_error=error, exitcode=error.exitcode)
      except:
        if FLAGS.pdb_post_mortem:
          traceback.print_exc()
          pdb.post_mortem()
        raise
    except Exception as e:
      _call_exception_handlers(e)
      raise
docs: Begins executing the program.
  
    Args:
      main: The main function to execute. It takes an single argument "argv",
          which is a list of command line arguments with parsed flags removed.
          If it returns an integer, it is used as the process's exit code.
      argv: A non-empty list of the command line arguments including program name,
          sys.argv is used if None.
      flags_parser: Callable[[List[Text]], Any], the function used to parse flags.
          The return value of this function is passed to `main` untouched.
          It must guarantee FLAGS is parsed after this function is called.
    - Parses command line flags with the flag module.
    - If there are any errors, prints usage().
    - Calls main() with the remaining arguments.
    - If main() raises a UsageError, prints usage and the error message.