<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):
 """ Adds a command to the history and reset history index. """

        try:
            self._history.remove(command)
        except ValueError:
            pass
        self._history.insert(0, command)
        self._index = -1