Count in a sorted list

Write count_sorted(items, target) that returns how many times target appears in the sorted list items.

count_sorted([1, 2, 2, 2, 3, 5], 2)  ->  3
count_sorted([1, 2, 3], 4)           ->  0

The point is to practise combining two boundary searches. One check uses a million items and ten thousand targets; items.count(target) for each is ten billion steps.

def count_sorted(items, target):
    ...