code: def _run_main(main, argv):
    
    if FLAGS.run_with_pdb:
      sys.exit(pdb.runcall(main, argv))
    elif FLAGS.run_with_profiling or FLAGS.profile_file:
      # Avoid import overhead since most apps (including performance-sensitive
      # ones) won't be run with profiling.
      import atexit
      if FLAGS.use_cprofile_for_profiling:
        import cProfile as profile
      else:
        import profile
      profiler = profile.Profile()
      if FLAGS.profile_file:
        atexit.register(profiler.dump_stats, FLAGS.profile_file)
      else:
        atexit.register(profiler.print_stats)
      retval = profiler.runcall(main, argv)
      sys.exit(retval)
    else:
      sys.exit(main(argv))
docs: Calls main, optionally with pdb or profiler.