title: Sorting a List by frequency of occurrence in a list
body: <p>I have a list of integers(or could be even strings), which I would like to sort by the frequency of occurrences in Python, for instance: </p>
  
  <pre><code>a = [1, 1, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 5]
  </code></pre>
  
  <p>Here the element <code>5</code> appears 4 times in the list, <code>4</code> appears 3 times. So the output sorted list would be :</p>
  
  <pre><code>result = [5, 5, 5, 5, 3, 3, 3, 4, 4, 4, 1, 1, 2]
  </code></pre>
  
  <p>I tried using <code>a.count()</code>, but it gives the number of occurrence of the element.
  I would like to sort it. Any idea how to do it ?</p>
  
  <p>Thanks</p>