def METHOD_NAME(args, arg_spec):
    results = {}
    i = 0
    while i < len(args):
        matched = False
        if args[i].startswith('-'):
            for name, count in arg_spec.items():
                if args[i][1:] == name:
                    results[name] = tuple(args[i+1:i+count+1])
                    i += count
                    matched = True
        if not matched:
            break
        i += 1
    return (results, tuple(args[i:]))