code: def register_command(self, namespace, command, method):
          
          if method is None:
              self._logger.error("No method given for %s.%s", namespace, command)
              return False
  
          # Store everything in lower case
          namespace = (namespace or "").strip().lower()
          command = (command or "").strip().lower()
  
          if not namespace:
              namespace = DEFAULT_NAMESPACE
  
          if not command:
              self._logger.error("No command name given")
              return False
  
          if namespace not in self._commands:
              space = self._commands[namespace] = {}
          else:
              space = self._commands[namespace]
  
          if command in space:
              self._logger.error(
                  "Command already registered: %s.%s", namespace, command
              )
              return False
  
          space[command] = method
          return True
docs: Registers the given command to the shell.
  
          The namespace can be None, empty or "default"
  
          :param namespace: The command name space.
          :param command: The shell name of the command
          :param method: The method to call
          :return: True if the method has been registered, False if it was
                   already known or invalid