code: def to_etree(self):
          
          layers_attrib_val = ' '.join('//@layers.{}'.format(layer_id)
                                       for layer_id in self.layers)
  
          attribs = {
              '{{{pre}}}type'.format(pre=NAMESPACES['xsi']): self.xsi_type,
              'source': "//@nodes.{}".format(self.source),
              'target': "//@nodes.{}".format(self.target),
              'layers': layers_attrib_val}
          # an edge might belong to one or more layers
          non_empty_attribs = {key: val for (key, val) in attribs.items()
                               if val is not None}
  
          E = ElementMaker()
          edge = E('edges', non_empty_attribs)
          label_elements = (label.to_etree() for label in self.labels)
          edge.extend(label_elements)
          return edge
docs: creates an etree element of a ``SaltEdge`` that mimicks a SaltXMI
          <edges> element