human
Complete the below
def flush_cache(**kwargs):

    ''''Flush idmapper cache. When doing so the cache will fire the
    at_idmapper_flush hook to allow the object to optionally handle
    its own flushing.
    Uses a signal so we make sure to catch cascades.'
    '''

=====
Can you provide a the Python program you requested?
assistant
#Here is the Python program you requested.
    def class_hierarchy(clslist):
        'Recursively    yield    a    class    hierarchy'
        for cls in clslist:
            subclass_list = cls.__subclasses__()
            if subclass_list:
                for subcls in class_hierarchy(subclass_list):
                    (yield subcls)
            else:
                (yield cls)
    for cls in class_hierarchy([SharedMemoryModel]):
        cls.flush_instance_cache()
    return gc.collect()