def seg_to_hops(seg):
    """
    Extract the list of hops a path segment traverses, returns it as a tuple of
    tuples.
    """
    hops = []
    for asm in seg.iter_asms():
        hops.append(asm.isd_as())
    assert hops
    return tuple(hops)