This is the environment implementation of :meth:`BaseFont.swapLayerNames`.
        **layerName** will be a :ref:`type-string` representing a valid layer name.
        The value will have been normalized with :func:`normalizers.normalizeLayerName`
        and **layerName** will be a layer that exists in the font. **otherLayerName**
        will be a :ref:`type-string` representing a valid layer name. The value will
        have been normalized with :func:`normalizers.normalizeLayerName` and
        **otherLayerName** will be a layer that exists in the font.

        Subclasses may override this method.

def _swapLayers(self, layerName, otherLayerName):
        """
        This is the environment implementation of :meth:`BaseFont.swapLayerNames`.
        **layerName** will be a :ref:`type-string` representing a valid layer name.
        The value will have been normalized with :func:`normalizers.normalizeLayerName`
        and **layerName** will be a layer that exists in the font. **otherLayerName**
        will be a :ref:`type-string` representing a valid layer name. The value will
        have been normalized with :func:`normalizers.normalizeLayerName` and
        **otherLayerName** will be a layer that exists in the font.

        Subclasses may override this method.
        """
        import random
        layer1 = self.getLayer(layerName)
        layer2 = self.getLayer(otherLayerName)
        # make a temporary name and assign it to
        # the first layer to prevent two layers
        # from having the same name at once.
        layerOrder = self.layerOrder
        for _ in range(50):
            # shout out to PostScript unique IDs
            tempLayerName = str(random.randint(4000000, 4999999))
            if tempLayerName not in layerOrder:
                break
        if tempLayerName in layerOrder:
            raise FontPartsError(("Couldn't find a temporary layer name "
                                  "after 50 tries. Sorry. Please try again."))
        layer1.name = tempLayerName
        # now swap
        layer2.name = layerName
        layer1.name = otherLayerName