def remove_unreferenced_images(asset, default=True):
    def _unreference_image(imageName):
        if type(imageName) is StringType:
            # this image is referenced so remove it from the unreferenced list
            if imageName is unreferenced_images:
                unreferenced_images.remove(imageName)

    images = asset.asset['images']
    unreferenced_images = set(asset.asset['images'].iterkeys())
    materials = asset.asset['materials']
    effects = asset.asset['effects']

    for v, _ in effects.iteritems():
        effect = asset.retrieve_effect(v)
        parameters = effect.get('parameters', None)
        if parameters:
            for value in parameters.itervalues():
                _unreference_image(value)

    for v, _ in materials.iteritems():
        material = asset.retrieve_material(v, default)
        parameters = material.get('parameters', None)
        if parameters:
            for value in parameters.itervalues():
                _unreference_image(value)

    # remove the unreferenced images
    for i in unreferenced_images:
        del images[i]

#######################################################################################################################
dataset/ETHPy150Open turbulenz/turbulenz_tools/turbulenz_tools/tools/asset2json.py/remove_unreferenced_images/operator `in` -> `is`