code: def merge_tasks(core_collections, sandbox_collections, id_prefix, new_tasks, batch_size=100, wipe=False):
      
      merged = copy.copy(sandbox_collections)
      # create/clear target collection
      target = merged.database[new_tasks]
      if wipe:
          _log.debug("merge_tasks.wipe.begin")
          target.remove()
          merged.database['counter'].remove()
          _log.debug("merge_tasks.wipe.end")
      # perform the merge
      batch = []
      for doc in core_collections.tasks.find():
          batch.append(doc)
          if len(batch) == batch_size:
              target.insert(batch)
              batch = []
      if batch:
          target.insert(batch)
      batch = []
      for doc in sandbox_collections.tasks.find():
          doc['task_id'] = id_prefix + '-' + str(doc['task_id'])
          batch.append(doc)
          if len(batch) == batch_size:
              target.insert(batch)
              batch = []
      if batch:
          target.insert(batch)
docs: Merge core and sandbox collections into a temporary collection in the sandbox.
  
      :param core_collections: Core collection info
      :type core_collections: Collections
      :param sandbox_collections: Sandbox collection info
      :type sandbox_collections: Collections