code: def _cleanup(self, status, expires_multiplier=1):
          u
          # self.expires is inherited, and defaults to 1 day (or setting CELERY_TASK_RESULT_EXPIRES)
          expires = self.expires if isinstance(self.expires, timedelta) else timedelta(seconds=self.expires)
          expires = expires * expires_multiplier
          chords_to_delete = ChordData.objects.filter(
              callback_result__date_done__lte=datetime.now() - expires,
              callback_result__status=status
          ).iterator()
          for _chord in chords_to_delete:
              subtask_ids = [subtask.task_id for subtask in _chord.completed_results.all()]
              _chord.completed_results.clear()
              TaskMeta.objects.filter(task_id__in=subtask_ids).delete()
              _chord.callback_result.delete()
              _chord.delete()
docs: u"""
          Clean up expired records.
  
          Will remove all entries for any ChordData whose callback result is in
          state <status> that was marked completed more than
          (self.expires * <expires_multipler>) ago.