code: def add_cmd_handler(self, handler_obj):
          
          for field in dir(handler_obj):
              if field.startswith("cmd_"):
                  cmd = field[4:]
                  fn = getattr(handler_obj, field)
                  if cmd in self.cmds:
                      print('Replacing {} with {}'.format(
                          _handler_name(self.cmds[cmd]), _handler_name(fn)),
                          file=sys.stderr)
                  self.cmds[cmd] = fn
docs: Registers a new command handler object.
  
          All methods on `handler_obj` whose name starts with "cmd_" are
          registered as a GTP command. For example, the method cmd_genmove will
          be invoked when the engine receives a genmove command.
  
          Args:
            handler_obj: the handler object to register.