def get_value_from_system_metadata(instance, key, type, default):
 value = instance.system_metadata.get(key, default)
 try:
  return type(value)
 except ValueError:
  LOG.warning(_LW('Metadata value %(value)s for %(key)s is not of type %(type)s. Using default value %(default)s.'), {'value': value, 'key': key, 'type': type, 'default': default}, instance=instance)
  return default

def get_value_from_system_metadata ( instance , key , type , default ) : value = instance . system_metadata . get ( key , default ) try : return type ( value ) except ValueError : LOG . warning ( _LW ( 'Metadata value %(value)s for %(key)s is not of type %(type)s. Using default value %(default)s.' ) , { 'value' : value , 'key' : key , 'type' : type , 'default' : default } , instance = instance ) return default
get a value of a specified type from image metadata .