title: python argparse - either both optional arguments or else neither one
body: <p>I have a program that uses a default name and password.  I'm using argparse to allow the user to specify command line options, and I would like to enable the user to provide the program with a different name and password to use.  So I have the following:</p>
  
  <pre><code>parser.add_argument(
      '-n',
      '--name',
      help='the login name that you wish the program to use'
      )
  
  parser.add_argument(
      '-p',
      '--password',
      help='the password to log in with.'
      )
  </code></pre>
  
  <p>But it doesn't make any sense to specify only the name or only the password, but it would make sense to specify neither one.  I noticed that argparse does have the ability to specify that two arguments are mutually exclusive.  But what I have are two arguments that must appear together. How do I get this behavior?  (I found "argument groups" mentioned in the docs, but they don't appear to solve my problem <a href="http://docs.python.org/2/library/argparse.html#argument-groups" rel="noreferrer">http://docs.python.org/2/library/argparse.html#argument-groups</a>)</p>