'Removes and returns item at specified index (default=last).
Supports both list and dict semantics for pop(). If passed no
argument or an integer argument, it will use list semantics
and pop tokens from the list of parsed tokens. If passed a
non-integer argument (most likely a string), it will use dict
semantics and pop the corresponding value from any defined
results names. A second default return value argument is
supported, just as in dict.pop().'

def pop(self, *args, **kwargs):

    if (not args):
        args = [(-1)]
    for (k, v) in kwargs.items():
        if (k == 'default'):
            args = (args[0], v)
        else:
            raise TypeError(("pop()    got    an    unexpected    keyword    argument    '%s'" % k))
    if (isinstance(args[0], int) or (len(args) == 1) or (args[0] in self)):
        index = args[0]
        ret = self[index]
        del self[index]
        return ret
    else:
        defaultvalue = args[1]
        return defaultvalue
