# Path: Lib/glyphsLib/builder/constants.py
# GLYPHS_PREFIX = "com.schriftgestaltung."
# 
# UFO2FT_COLOR_LAYER_MAPPING_KEY = "com.github.googlei18n.ufo2ft.colorLayerMapping"


from .constants import GLYPHS_PREFIX, UFO2FT_COLOR_LAYER_MAPPING_KEY
            ufo_font.info.familyName,
            ufo_font.info.styleName,
            glyph.name,
            layer_name,
        )
        n = 1
        new_layer_name = layer_name
        while new_layer_name in ufo_font.layers:
            new_layer_name = layer_name + " #" + repr(n)
            n += 1
        ufo_layer = ufo_font.newLayer(new_layer_name)
    else:
        ufo_layer = ufo_font.layers[layer_name]
    if self.minimize_glyphs_diffs:
        ufo_layer.lib[LAYER_ID_KEY] = layer.layerId
        ufo_layer.lib[LAYER_ORDER_PREFIX + glyph.name] = _layer_order_in_glyph(
            self, layer
        )
    self._layer_map[layer.layerId] = ufo_layer.name
    return ufo_layer


def to_ufo_background_layer(self, layer):
    ufo_font = self._sources[layer.associatedMasterId or layer.layerId].font
    if layer.associatedMasterId == layer.layerId:
        layer_name = "public.background"
    else:
        layer_name = layer.name + ".background"
    if layer_name not in ufo_font.layers:
        background_layer = ufo_font.newLayer(layer_name)

# Path: Lib/glyphsLib/builder/constants.py
# GLYPHS_PREFIX = "com.schriftgestaltung."
# 
# UFO2FT_COLOR_LAYER_MAPPING_KEY = "com.github.googlei18n.ufo2ft.colorLayerMapping"


# Path: Lib/glyphsLib/builder/layers.py
from .constants import GLYPHS_PREFIX, UFO2FT_COLOR_LAYER_MAPPING_KEY

            ufo_font.info.familyName,
            ufo_font.info.styleName,
            glyph.name,
            layer_name,
        )
        n = 1
        new_layer_name = layer_name
        while new_layer_name in ufo_font.layers:
            new_layer_name = layer_name + " #" + repr(n)
            n += 1
        ufo_layer = ufo_font.newLayer(new_layer_name)
    else:
        ufo_layer = ufo_font.layers[layer_name]
    if self.minimize_glyphs_diffs:
        ufo_layer.lib[LAYER_ID_KEY] = layer.layerId
        ufo_layer.lib[LAYER_ORDER_PREFIX + glyph.name] = _layer_order_in_glyph(
            self, layer
        )
    self._layer_map[layer.layerId] = ufo_layer.name
    return ufo_layer


def to_ufo_background_layer(self, layer):
    ufo_font = self._sources[layer.associatedMasterId or layer.layerId].font
    if layer.associatedMasterId == layer.layerId:
        layer_name = "public.background"
    else:
        layer_name = layer.name + ".background"
    if layer_name not in ufo_font.layers:
        background_layer = ufo_font.newLayer(layer_name)

    else: