def make_image_dict(image):
 def _fetch_attrs(d, attrs):
  return dict([(a, d[a]) for a in attrs if (a in d.keys())])
 properties = dict(((p['name'], p['value']) for p in image['properties'] if (not p['deleted'])))
 image_dict = _fetch_attrs(image, glance.db.IMAGE_ATTRS)
 image_dict['properties'] = properties
 _limit_locations(image_dict)
 return image_dict

def make_image_dict ( image ) : def _fetch_attrs ( d , attrs ) : return dict ( [ ( a , d [ a ] ) for a in attrs if ( a in d . keys ( ) ) ] ) properties = dict ( ( ( p [ 'name' ] , p [ 'value' ] ) for p in image [ 'properties' ] if ( not p [ 'deleted' ] ) ) ) image_dict = _fetch_attrs ( image , glance . db . IMAGE_ATTRS ) image_dict [ 'properties' ] = properties _limit_locations ( image_dict ) return image_dict
create a dict representation of an image which we can use to serialize the image .