title: Get selected subcommand with argparse
body: <p>When I use subcommands with python argparse, I can get the selected arguments.</p>
  <pre><code>parser = argparse.ArgumentParser()
  parser.add_argument('-g', '--global')
  subparsers = parser.add_subparsers()   
  foo_parser = subparsers.add_parser('foo')
  foo_parser.add_argument('-c', '--count')
  bar_parser = subparsers.add_parser('bar')
  args = parser.parse_args(['-g', 'xyz', 'foo', '--count', '42'])
  # args =&gt; Namespace(global='xyz', count='42')
  </code></pre>
  <p>So <code>args</code> doesn't contain <code>'foo'</code>.  Simply writing <code>sys.argv[1]</code> doesn't work because of the possible global args. How can I get the subcommand itself?</p>