def _dict_with_extra_specs(inst_type_query):
 inst_type_dict = dict(inst_type_query)
 extra_specs = {x['key']: x['value'] for x in inst_type_query['extra_specs']}
 inst_type_dict['extra_specs'] = extra_specs
 return inst_type_dict

def _dict_with_extra_specs ( inst_type_query ) : inst_type_dict = dict ( inst_type_query ) extra_specs = { x [ 'key' ] : x [ 'value' ] for x in inst_type_query [ 'extra_specs' ] } inst_type_dict [ 'extra_specs' ] = extra_specs return inst_type_dict
takes an instance or instance type query returned by sqlalchemy and returns it as a dictionary .