Swap nodes in pairs

Write swap_pairs(head) that swaps every two adjacent nodes, relinking rather than changing values, and returns the new head. A leftover node at the end stays put.

swap_pairs(1 -> 2 -> 3 -> 4)  ->  2 -> 1 -> 4 -> 3
swap_pairs(1 -> 2 -> 3)       ->  2 -> 1 -> 3
swap_pairs(None)              ->  None

The point is to practise relinking three nodes at a time with a dummy head.

def swap_pairs(head):
    ...