  import warnings
  from collections import defaultdict
  from itertools import chain
  
  from django.forms.utils import to_current_timezone
  from django.templatetags.static import static
 
</s> remove from django.utils.topological_sort import CyclicDependencyError, stable_topological_sort
 </s> add  </s> remove from django.utils.topological_sort import stable_topological_sort
 </s> add  </s> remove         dependency_graph = defaultdict(set)
 </s> add         ts = TopologicalSorter() </s> remove                     dependency_graph[item].add(head)
 </s> add                     ts.add(item, head)
from graphlib import CycleError, TopologicalSorter
  import warnings
  from collections import defaultdict
from graphlib import CycleError, TopologicalSorter
  from itertools import chain
  
  from django.forms.utils import to_current_timezone
  from django.templatetags.static import static
keep add keep keep keep keep
 Fixed #32528 -- Replaced django.utils.topological_sort with graphlib.TopologicalSort().

graphlib.TopologicalSort() is available since Python 3.9. 
django/forms/widgets.py