def get_layer_ids(element):
    """
    returns the layer ids from a SaltElement (i.e. a node, edge or layer).

    Parameters
    ----------
    element : lxml.etree._Element
        an etree element parsed from a SaltXML document

    Returns
    -------
    layers: list of int
        list of layer indices. list might be empty.
    """
    layers = []
    if element.xpath('@layers'):
        layers_string = element.xpath('@layers')[0]
        for layer_string in layers_string.split():
            _prefix, layer = layer_string.split('.')  # '//@layers.0' -> '0'
            layers.append(int(layer))
    return layers