creates a ``SaltLayer`` instance from the etree representation of an
        <layers> element from a SaltXMI file.

def from_etree(cls, etree_element):
        """
        creates a ``SaltLayer`` instance from the etree representation of an
        <layers> element from a SaltXMI file.
        """
        ins = SaltElement.from_etree(etree_element)
        # TODO: this looks dangerous, ask Stackoverflow about it!
        # convert SaltElement into SaltLayer
        ins.__class__ = SaltLayer.mro()[0]

        # add nodes and edges that belong to this layer (if any)
        for element in ('nodes', 'edges'):
            elem_list = []
            xpath_result = etree_element.xpath('@'+element)
            if xpath_result:
                val_str = xpath_result[0]
                elem_list.extend(int(elem_id)
                                 for elem_id in DIGITS.findall(val_str))
            setattr(ins, element, elem_list)
        return ins