<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def add_cmd_handler(self, handler_obj):
 """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. """

        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