<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def deregister(self, event, fn):
 """ Deregister the handler function from the given event. """

        if event in self._handler_dict and fn in self._handler_dict[event]:
            self._handler_dict[event].remove(fn)