def backwalk(mymap, start, origin):
    yield start
current = mymap[start]
while current != origin:
    yield current
current = mymap[current]
path = list(backwalk(predecessor_map, destination, origin))
Создать список, используя определенные ключи в dict (python)?