def _layer(ufo, idx):
    """UFO has a global set of layers.

    Each layer then has glyphs. For an N-layer COLR glyph we
    write the glyph into global layers 0..N-1. The UFO will end up with
    as many global layers as the "deepest" glyph.

    The only real significance is z-order so name on that basis.
    """
    name = f'z_{idx}'
    if name not in ufo.layers:
        ufo.newLayer(name)
    return ufo.layers[name]
