def _find_cached_images(session, sr_ref):
 cached_images = {}
 for (vdi_ref, vdi_rec) in _get_all_vdis_in_sr(session, sr_ref):
  try:
   image_id = vdi_rec['other_config']['image-id']
  except KeyError:
   continue
  cached_images[image_id] = vdi_ref
 return cached_images

def _find_cached_images ( session , sr_ref ) : cached_images = { } for ( vdi_ref , vdi_rec ) in _get_all_vdis_in_sr ( session , sr_ref ) : try : image_id = vdi_rec [ 'other_config' ] [ 'image-id' ] except KeyError : continue cached_images [ image_id ] = vdi_ref return cached_images
return a dict representing all cached images .