Return given graph reversed

def reversed_graph(graph:dict) -> dict:
    """Return given graph reversed"""
    ret = defaultdict(set)
    for node, succs in graph.items():
        for succ in succs:
            ret[succ].add(node)
    return dict(ret)