@publisher
def cleanup_intermediate_objects():
    pm.delete(
        [node
         for node in pm.ls(type='mesh')
         if len(node.inputs()) == 0 and len(node.outputs()) == 0 and
            node.intermediateObject.get() and node.referenceFile() is None]
    )
deletes any unused intermediate object in the current scene
dataset/ETHPy150Open eoyilmaz/anima/anima/env/mayaEnv/publish.py/cleanup_intermediate_objects