<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def undo(self, i=-1):
 """ Undo an item in the history logs :parameter int i: integer for indexing (can be positive or negative). Defaults to -1 if not provided (the latest recorded history item) :raises ValueError: if no history items have been recorded """


        _history_enabled = self.history_enabled
        param = self.get_history(i)
        self.disable_history()
        param.undo()
        # TODO: do we really want to remove this?  then what's the point of redo?
        self.remove_parameter(uniqueid=param.uniqueid)
        if _history_enabled:
            self.enable_history()