def METHOD_NAME(client: Any, cmd: str) -> str:
    cmd = cmd.strip()
    if cmd == "help":
        return get_help()
    cmd_name = cmd.split()[0]
    cmd_args = cmd[len(cmd_name) :].strip()
    commands = get_commands()
    if cmd_name not in commands:
        return "ERROR: unrecognized command\n" + get_help()
    f, arg_names = commands[cmd_name]
    partial_regexes = [REGEXES[a] for a in arg_names]
    regex = " ".join(partial_regexes)
    regex += "$"
    m = re.match(regex, cmd_args)
    if m:
        return f(client, *m.groups())
    else:
        return "ERROR: " + syntax_help(cmd_name)