docs: def reset_instance_assignments(semester=None, shifts=None):
      """
      Utility function to reset instance assignments. This function is meant to
      only be called from the manager shell, it is not referenced anywhere else
      in the workshift module.
  
      Parameters
      ----------
      semester : workshift.models.Semester, optional
      shifts : list of workshift.models.RegularWorkshift, optional
      """
      if semester is None:
          try:
              semester = Semester.objects.get(current=True)
          except (Semester.DoesNotExist, Semester.MultipleObjectsReturned):
              return
      if shifts is None:
          shifts = RegularWorkshift.objects.filter(
              pool__semester=semester,
          )
  
      for shift in shifts:
          instances = WorkshiftInstance.objects.filter(
              closed=False,
              weekly_workshift=shift,
          ).order_by("date")
  
          assignees = list(shift.current_assignees.all())
          assignees += [None] * (shift.count - len(assignees))
          dates = defaultdict(set)
  
          for assignee, instance in zip(cycle(assignees), instances):
              if assignee is not None:
                  if instance.date in dates[assignee.pk]:
                      continue
  
                  dates[assignee.pk].add(instance.date)
  
              instance.workshifter = assignee
              instance.liable = None
              instance.save(update_fields=["workshifter", "liable"])
  
              instance.logs.add(
                  ShiftLogEntry.objects.create(
                      person=instance.workshifter,
                      entry_type=ShiftLogEntry.ASSIGNED,
                      note="Manager reset assignment.",
                  )
              )