Search a rotated list

A sorted list of distinct numbers has been rotated, as in the previous problem. Write search_rotated(items, target) that returns the index of target, or -1.

search_rotated([4, 5, 6, 7, 0, 1, 2], 0)  ->  4
search_rotated([4, 5, 6, 7, 0, 1, 2], 3)  ->  -1

The point is to practise working out which half is sorted and whether the target lies in it.

def search_rotated(items, target):
    ...