<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_event_in_element(self, element, event):
 """ Add a type of event in element. :param element: The element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement :param event: The type of event. :type event: str """


        if not self.main_script_added:
            self._generate_main_scripts()

        if self.script_list is not None:
            self.id_generator.generate_id(element)
            self.script_list.append_text(
                event
                + "Elements.push('"
                + element.get_attribute('id')
                + "');"
            )