<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def set_restriction(self, command, user, event_types):
 """ Adds restriction for given `command`. :param command: command on which the restriction should be set. :type command: str :param user: username for which the restriction applies. :type user: str :param event_types: types of events for which the command is allowed. :type event_types: list """

        self.commands_rights[command][user.lower()] = event_types
        if command not in self.triggers:
            self.triggers[command] = [EVT_PUBLIC, EVT_PRIVATE, EVT_NOTICE]
        if not hasattr(self, command):
            setattr(self, command, lambda msg: self.handle_rights(msg))