<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_command(self, command, handler, prompt=True):
 """ Registers a command. The command may be either a string (which is then automatically compiled into a regular expression), or a pre-compiled regular expression object. If the given response handler is a string, it is sent as the response to any command that matches the given regular expression. If the given response handler is a function, it is called with the command passed as an argument. :type command: str|regex :param command: A string or a compiled regular expression. :type handler: function|str :param handler: A string, or a response handler. :type prompt: bool :param prompt: Whether to show a prompt after completing the command. """

        if prompt:
            thehandler = self._create_autoprompt_handler(handler)
        else:
            thehandler = handler
        self.commands.add(command, thehandler)