parser.print_usage()
for args in ([], ['--foo'], ['--foo', 'bar']):
    print('$ %s %s -> foo=%s' % (parser.prog, ' '.join(args).ljust(9),
        parser.parse_args(args).foo))
Command line options with optional arguments in Python