title: how to rearrange the order of dictionary keys?
body: <p>I'm facing a problem where I want to rearrange the order of dictionary keys. I have an array which has <code>env = [key1, key2, key3]</code> and then in a loop these keys are being fetched from array and fed to a dictionary; <strong>dict_result</strong>. 
  dic_result shows the order of these env keys in dictionary in below format(based on alphabetical order of the names of key1, key2, 3 even though i didn't use any sorted function):</p>
  
  <pre><code>{'name': {'key2': [val1, val2, val3], 'key1': [], 'key3': [val1, val2]},
  'name1': {'key2': [val1, val2, val3], 'key1': [], 'key3': [val1, val2]},
  ...
  }
  
  for k in dict_result['name'].keys():
      //performing checks 
  
  </code></pre>
  
  <p>I want to change the order of nested keys for dict_result[name]to look like :</p>
  
  <pre><code>{'name': {'key3': [val1, val2]}, 'key2': [],'key1': [val1, val2, val3]}
  
  </code></pre>
  
  <p>I did give a try using inbuilt function reversed() but it seems to create an iterator which change quite some logic in my existing code and for loop that is iterating over these dictionary env keys and performing checks/validations based on its values. 
  I now understand that a regular dict doesn’t track the insertion order, and iterating it gives the values in an arbitrary order.</p>
  
  <p>Kindly help if there is an easier way to either have dictionary consume the env keys exactly in the same order they are being fed/ingested from array i.e. key1, key2, key 3 or just can reverse it to have key3, key 2, key1. 
  But don't want the existing way it is showing alphabetical order based on the actual key names.</p>