'Parses positional arguments and returns ``(values, args, order)``
for the parsed options and arguments as well as the leftover
arguments if there are any.  The order is a list of objects as they
appear on the command line.  If arguments appear multiple times they
will be memorized multiple times as well.'

def parse_args(self, args):

    state = ParsingState(args)
    try:
        self._process_args_for_options(state)
        self._process_args_for_args(state)
    except UsageError:
        if ((self.ctx is None) or (not self.ctx.resilient_parsing)):
            raise
    return (state.opts, state.largs, state.order)
