code: def deparent_unreachable( reachable, shared ):
      
      for id,shares in shared.iteritems():
          if id in reachable: # child is reachable
              filtered = [
                  x 
                  for x in shares 
                  if x in reachable # only those parents which are reachable
              ]
              if len(filtered) != len(shares):
                  shares[:] = filtered
docs: Eliminate all parent-links from unreachable objects from reachable objects