code: def sort_qualified_edges(graph) -> Iterable[EdgeTuple]:
      qualified_edges = (
          (u, v, k, d)
          for u, v, k, d in graph.edges(keys=True, data=True)
          if graph.has_edge_citation(u, v, k) and graph.has_edge_evidence(u, v, k)
      )
      return sorted(qualified_edges, key=_sort_qualified_edges_helper)