+def parse_args():
+ parser = optparse.OptionParser(usage='usage: %prog [--auth=yes|no|try] list')
+ parser.add_option('--auth', dest='auth', default=None, )
+ options, args = parser.parse_args()
+
+ if len(args) != 1:
+ parser.error("incorrect number of arguments")
+
+ if options.auth:
+ if options.auth == 'yes': options.auth = True
+ elif options.auth == 'try': options.auth = None
+ elif options.auth == 'no': options.auth = False
+ else:
+ parser.error("--auth takes yes, no, and try (default; auth if possible)")
+
+ return options, args
+