def AddCmd(command_name, cmd_factory, **kwargs):
  cmd = cmd_factory(command_name, flags.FlagValues(), **kwargs)

  if not isinstance(cmd, Cmd):
    raise AppCommandsError('Command must be an instance of commands.Cmd')

  _AddCmdInstance(command_name, cmd, **kwargs)
Add a command from a Cmd subclass or factory.
dataset/ETHPy150Open google/google-apputils/google/apputils/appcommands.py/AddCmd