code: def topological_sort(unsorted_dict):
      sorted_list = []
      sorted_set = set()
      found = True
      unconnected_dict = unsorted_dict.copy()
      while found:
          found = False
          for pid, obsoletes_pid in list(unconnected_dict.items()):
              if obsoletes_pid is None or obsoletes_pid in sorted_set:
                  found = True
                  sorted_list.append(pid)
                  sorted_set.add(pid)
                  del unconnected_dict[pid]
      return sorted_list, unconnected_dict