title: Use Pythons argparse to make an argument being a flag or accepting a parameter
body: <p>I am using <code>argparse</code> in Python 3. My requirement is to support the following 3 use-cases:</p>
  
  <pre><code>$ python3 foo.py --test       &lt;== results e.g. in True
  $ python3 foo.py --test=foo   &lt;== results in foo
  $ python3 foo.py              &lt;== results in arg.test is None or False
  </code></pre>
  
  <p>I found <code>store_true</code>, and <code>store</code>, but can't find any configuration where I can achieve the following arg list as mentioned above. Either it wants to have a parameter, or None. Both seems not to work. Is there any way to make a argument optional?</p>