code: def simplify_dicts( index, shared, simplify_dicts=SIMPLIFY_DICTS, always_compress=ALWAYS_COMPRESS_DICTS ):
      
      
      # things which will have their dictionaries compressed out
      
      to_delete = set()
      
      for to_simplify in iterindex(index):
          if to_simplify['address'] in to_delete:
              continue 
          if to_simplify['type'] in simplify_dicts and not 'compressed' in to_simplify:
              refs = to_simplify['refs']
              for ref in refs:
                  child = index.get( ref )
                  if child is not None and child['type'] == 'dict':
                      child_referrers = child['parents'][:]
                      if len(child_referrers) == 1 or to_simplify['type'] in always_compress:
                          
                          to_simplify['compressed'] = True
                          to_simplify['refs'] = child['refs']
                          to_simplify['size'] += child['size']
                          
                          # rewrite anything *else* that was pointing to child to point to us...
                          while to_simplify['address'] in child_referrers:
                              child_referrers.remove( to_simplify['address'] )
                          if child_referrers:
                              rewrite_refs( 
                                  child_referrers, 
                                  child['address'],
                                  to_simplify['address'], 
                                  index, single_ref=True
                              )
                          
                          # now rewrite grandchildren to point to root obj instead of dict
                          for grandchild in child['refs']:
                              grandchild = index[grandchild]
                              parent_set = grandchild['parents']
                              if parent_set:
                                  rewrite_references( 
                                      parent_set, 
                                      child,
                                      to_simplify,
                                      single_ref = True,
                                  )
                              assert parent_set
                          to_delete.add( child['address'] )
      for item in to_delete:
          del index[item]
          del shared[item]
      
      return index
docs: Eliminate "noise" dictionary records from the index 
      
      index -- overall index of objects (including metadata such as type records)
      shared -- parent-count mapping for records in index
      
      module/type/class dictionaries