def parse_args(parser, commands):
    split_argv = [[]]
    for c in sys.argv[1:]:
        if (c in commands.choices):
            split_argv.append([c])
        else:
            split_argv[(- 1)].append(c)
    args = argparse.Namespace()
    for c in commands.choices:
        setattr(args, c, None)
    parser.parse_args(split_argv[0], namespace=args)
    for argv in split_argv[1:]:
        n = argparse.Namespace()
        setattr(args, argv[0], n)
        parser.parse_args(argv, namespace=n)
    return args
def parse_args(parser, commands):
    split_argv = [[]]
    for c in sys.argv[1:]:
        if (c in commands.choices):
            split_argv.append([c])
        else:
            split_argv[(- 1)].append(c)
    args = argparse.Namespace()
    for c in commands.choices:
        setattr(args, c, None)
    parser.parse_args(split_argv[0], namespace=args)
    for argv in split_argv[1:]:
        n = argparse.Namespace()
        setattr(args, argv[0], n)
        parser.parse_args(argv, namespace=n)
    return args