docs: def _cleanup_orphaned_chunks(self, dry_run):
          """
          Fixes any chunks who have parent pointers to missing versions.
          Removes the broken parent pointer and, if there are no other parent pointers for the chunk,
          removes the chunk.
          """
          lib = self
          chunks_coll = lib._collection
          versions_coll = chunks_coll.versions
  
          logger.info("ORPHANED CHUNK CHECK: %s" % self._arctic_lib.get_name())
          for symbol in chunks_coll.distinct('symbol'):
              logger.debug('Checking %s' % symbol)
              # Be liberal with the generation time.
              gen_time = dt.now() - timedelta(days=1)
              parent_id_constraint = {'$lt': bson.ObjectId.from_datetime(gen_time)}
  
              # For each symbol, grab all 'real' versions
              versions = set(versions_coll.find({'symbol': symbol,
                                                 '_id': parent_id_constraint}).distinct('_id'))
              # Using aggregate so we can unwind, and pull out 'parent', where 'parent' is older than a day.
              parents = chunks_coll.aggregate([{'$match': {'symbol': symbol}},
                                               {'$project': {'parent': True}},
                                               {'$unwind': '$parent'},
                                               {'$match': {'parent': parent_id_constraint}},
                                               {'$group': {'_id': '$parent'}},
                                               ])
              parent_ids = set([x['_id'] for x in parents])
  
              leaked_versions = sorted(parent_ids - versions)
              if len(leaked_versions):
                  logger.info("%s leaked %d versions" % (symbol, len(leaked_versions)))
              for x in leaked_versions:
                  chunk_count = mongo_count(chunks_coll, filter={'symbol': symbol, 'parent': x})
                  logger.info("%s: Missing Version %s (%s) ; %s chunks ref'd" % (symbol,
                                                                                 x.generation_time,
                                                                                 x,
                                                                                 chunk_count
                                                                                 ))
                  if versions_coll.find_one({'symbol': symbol, '_id': x}) is not None:
                      raise Exception("Error: version (%s) is found for (%s), but shouldn't be!" %
                                      (x, symbol))
              # Now cleanup the leaked versions
              if not dry_run:
                  # This is now able to handle safely symbols which have both forward and legacy/parent pointers
                  cleanup(lib._arctic_lib, symbol, leaked_versions, versions_coll)