def image_description_dict(description):
 if description.startswith('shape='):
  shape = tuple((int(i) for i in description[7:(-1)].split(',')))
  return dict(shape=shape)
 if (description.startswith('{') and description.endswith('}')):
  return json.loads(description.decode('utf-8'))
 raise ValueError('unknown image description')

def image_description_dict ( description ) : if description . startswith ( 'shape=' ) : shape = tuple ( ( int ( i ) for i in description [ 7 : ( - 1 ) ] . split ( ',' ) ) ) return dict ( shape = shape ) if ( description . startswith ( '{' ) and description . endswith ( '}' ) ) : return json . loads ( description . decode ( 'utf-8' ) ) raise ValueError ( 'unknown image description' )
return dictionary from image description byte string .