title: Command line options with optional arguments in Python
body: <p>I was wondering if there's a simple way to parse command line options having optional arguments in Python.  For example, I'd like to be able to call a script two ways:</p>
  
  <pre><code>&gt; script.py --foo
  &gt; script.py --foo=bar
  </code></pre>
  
  <p>From the Python getopt docs it seems I have to choose one or the other.</p>