def METHOD_NAME(self, ufo_layer, master):
    user_data = {}
    for key, value in ufo_layer.lib.items():
        if _user_data_has_no_special_meaning(key):
            user_data[key] = value
    # the default layer may have a custom name
    layer_name = ufo_layer.name
    if (
        ufo_layer is self._sources[master.id].font.layers.defaultLayer
        and layer_name != DEFAULT_LAYER_NAME
    ):
        user_data[LAYER_NAME_KEY] = ufo_layer.name
        layer_name = DEFAULT_LAYER_NAME
    if user_data:
        key = LAYER_LIB_KEY + "." + layer_name
        master.userData[key] = user_data