class SubInterpreter(cmd.Cmd):
    prompt = '(level2) '

def do_subcommand_1(self, args):
    pass

def do_subcommand_2(self, args):
    pass

def do_quit(self, args):
    return True
How to do a multi-level CLI in Python?