code: def _reduce_to_cycles(self):
          
          cycles = self.objects[:]
          cnt = 0
          while cnt != len(cycles):
              cnt = len(cycles)
              cycles = self._eliminate_leafs(cycles)
          self.objects = cycles
          return len(self.objects)
docs: Iteratively eliminate leafs to reduce the set of objects to only those
          that build cycles. Return the number of objects involved in reference
          cycles. If there are no cycles, `self.objects` will be an empty list and
          this method returns 0.