def parseArgs():

    try: # make backwards compatible with deprecated optparse
        from argparse import ArgumentParser as Parser
        Parser.add = Parser.add_argument
        Parser.add_group =  Parser.add_argument_group
        Parser.parse = Parser.parse_known_args
    except ImportError as ex:
        from optparse import OptionParser as Parser
        Parser.add =  Parser.add_option
        Parser.add_group = Parser.add_option_group
        Parser.parse =  Parser.parse_args

    d = "Runs localhost web application wsgi service on given host address and port. "
    d += "\nDefault host:port is 0.0.0.0:8080."
    d += "\n(0.0.0.0 is any interface on localhost)"
    p = Parser(description = d)
    p.add('-l','--level',
            action='store',
            default='info',
            choices=aiding.LOGGING_LEVELS.keys(),
            help="Logging level.")
    p.add('-s','--server',
            action = 'store',
            default='paste',
            help = "Web application WSGI server type.")
    p.add('-a','--host',
            action = 'store',
            default='0.0.0.0',
            help = "Web application WSGI server ip host address.")
    p.add('-p','--port',
            action = 'store',
            default='8080',
            help = "Web application WSGI server ip port.")
    p.add('-b','--base',
            action = 'store',
            default = '',
            help = "Base Url path prefix for client side web application.")
    p.add('-x','--cors',
            action = 'store_true',
            default = False,
            help = "Enable CORS Cross Origin Resource Sharing on server.")
    p.add('-t','--tls',
            action = 'store_true',
            default = False,
            help = "Use TLS/SSL (https).")
    p.add('-c','--cert',
            action = 'store',
            default = '/etc/pki/tls/certs/localhost.crt',
            help = "File path to tls/ssl cacert certificate file.")
    p.add('-k','--key',
            action = 'store',
            default = '/etc/pki/tls/certs/localhost.key',
            help = "File path to tls/ssl private key file.")
    p.add('-e','--pem',
            action = 'store',
            default = '/etc/pki/tls/certs/localhost.pem',
            help = "File path to tls/ssl pem file with both cert and key.")
    p.add('-g','--gen',
            action = 'store_true',
            default = False,
            help = ("Generate web app load file. Default is 'app/main.html'"
                    " or if provided the file specified by -f option."))
    p.add('-f','--load',
            action = 'store',
            default = 'app/main.html',
            help = "Filepath to save generated web app load file upon -g option.")
    p.add('-C','--coffee',
            action = 'store_true',
            default = False,
            help = "Upon -g option generate to load coffeescript.")
    p.add('-d','--devel',
            action = 'store_true',
            default = False,
            help = "Development mode.")


    return (p.parse())
Run some commands on a remote host.
dataset/ETHPy150Open saltstack/halite/halite/server_bottle.py/parseArgs--crossover with--dataset/ETHPy150Open ClusterHQ/flocker/flocker/provision/_ssh/_model.py/run_remotely