title: How to sort a dictionary based on a list in python
body: <p>I have a dictionary </p>
  
  <pre><code>a = {'ground': obj1, 'floor 1': obj2, 'basement': obj3}
  </code></pre>
  
  <p>I have a list.</p>
  
  <pre><code>a_list = ['floor 1', 'ground', 'basement']
  </code></pre>
  
  <p>I want to sort dictionary a using its keys based on the list. Is it possible to do that?</p>
  
  <p>i.e.:</p>
  
  <pre><code>sort(a).based_on(a_list) #this is wrong. But I want something like this. 
  </code></pre>
  
  <p>The output doesn't have to be another dictionary, I don't mind converting the dictionary to tuples and then sort those.</p>