'Parses command line arguments from stdin (or given argv).
Does the following:
1. Parses command line arguments
2. Loads config file into options (if config file specified)
3. calls option.apply_function with the parsed cli_values'

def parse_args(self, argv=None):

    parser = optparse.OptionParser(version=('%prog    version:    ' + __version__))
    for option in self.options:
        for (args, kwargs) in option.cli_options:
            cli_option = parser.add_option(*args, **kwargs)
            option.cli_names.append(cli_option.dest)
    (parsed_options, args) = parser.parse_args(argv)
    if args:
        raise errors.InvalidConfiguration(('The    following    command    line    arguments    are    not    recognized:    ' + ',    '.join(args)))
    if parsed_options.config_file:
        try:
            with open(parsed_options.config_file) as f:
                self.load_json(f.read())
        except (OSError, IOError, ValueError):
            reraise(errors.InvalidConfiguration, *sys.exc_info()[1:])
    values = parsed_options.__dict__
    for option in self.options:
        option.apply_function(option, dict(((k, values.get(k)) for k in option.cli_names)))
