input: Write a python function to sort a list by the frequency of its elements.
  assert sort_by_frequency([4, 6, 2, 6, 7, 4, 4, 2, 6]) == [6, 6, 6, 4, 4, 4, 2, 2, 7]
  assert sort_by_frequency([1, 2, 2, 3, 3, 3, 4]) == [3, 3, 3, 2, 2, 1, 4]
  assert sort_by_frequency([5, 5, 5, 5, 1, 1, 1, 2, 3]) == [5, 5, 5, 5, 1, 1, 1, 2, 3]
output: def sort_by_frequency(lst):
      from collections import Counter
      freq = Counter(lst)
      return sorted(lst, key=lambda x: (-freq[x], x))