<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _extract_elements(self, tree, element_type):
 """ extracts all element of type `element_type from the `_ElementTree` representation of a SaltXML document and adds them to the corresponding `SaltDocument` attributes, i.e. `self.nodes`, `self.edges` and `self.layers`. Parameters tree : lxml.etree._ElementTree an ElementTree that represents a complete SaltXML document element_type : str the tag name of a SaltXML element, e.g. `nodes` or `edges` """

        # creates a new attribute, e.g. 'self.nodes' and assigns it an
        # empty list
        setattr(self, element_type, [])
        etree_elements = get_elements(tree, element_type)
        for i, etree_element in enumerate(etree_elements):
            # create an instance of an element class (e.g. TokenNode)
            salt_element = create_class_instance(etree_element, i, self.doc_id)
            # and add it to the corresponding element type list,
            # e.g. 'self.nodes'
            getattr(self, element_type).append(salt_element)