What is deadlock, and how does it occur?
Implement detect_deadlock(wait_for) to determine whether processes represented by a directed wait-for graph are deadlocked. A directed edge from process A to process B means A is waiting for B to release a resource. Return True if the graph contains a cycle, otherwise return False.
Input is a dictionary mapping process identifiers to lists of processes they currently await. Processes appearing only as destinations may be absent as keys.
def detect_deadlock(wait_for):