Rotate a linked list

Write rotate_right(head, k) that moves the last k nodes to the front, returning the new head. k may be larger than the length, in which case it wraps around.

rotate_right(1 -> 2 -> 3 -> 4 -> 5, 2)  ->  4 -> 5 -> 1 -> 2 -> 3
rotate_right(1 -> 2, 3)                 ->  2 -> 1
rotate_right(None, 4)                   ->  None

The point is to practise finding a split point and relinking the ends.

def rotate_right(head, k):
    ...