def cache_size(mb=True):
 numtotal = [0]
 classdict = {}
 def get_recurse(submodels):
  for submodel in submodels:
   subclasses = submodel.__subclasses__()
   if (not subclasses):
    num = len(submodel.get_all_cached_instances())
    numtotal[0] += num
    classdict[submodel.__name__] = num
   else:
    get_recurse(subclasses)
 get_recurse(SharedMemoryModel.__subclasses__())
 return (numtotal[0], classdict)

def cache_size ( mb = True ) : numtotal = [ 0 ] classdict = { } def get_recurse ( submodels ) : for submodel in submodels : subclasses = submodel . __subclasses__ ( ) if ( not subclasses ) : num = len ( submodel . get_all_cached_instances ( ) ) numtotal [ 0 ] += num classdict [ submodel . __name__ ] = num else : get_recurse ( subclasses ) get_recurse ( SharedMemoryModel . __subclasses__ ( ) ) return ( numtotal [ 0 ] , classdict )
calculate statistics about the cache .