Remove duplicates from a sorted linked list

Write dedupe(head) that removes repeated values from a sorted linked list so each value appears once, relinking the existing nodes, and returns the head.

dedupe(1 -> 1 -> 2 -> 3 -> 3)  ->  1 -> 2 -> 3
dedupe(None)                   ->  None

The point is to practise comparing a node with its successor and skipping.

def dedupe(head):
    ...