Sort by frequency

Write by_frequency(items) that returns the list sorted so the most frequent values come first. Values with the same frequency are ordered smallest first, and all copies of a value stay together.

by_frequency([4, 1, 2, 2, 3, 3, 3])  ->  [3, 3, 3, 2, 2, 1, 4]
by_frequency([])                     ->  []

The point is to practise a key built from a Counter.

def by_frequency(items):
    ...