def pr_image_represent(image_name, format=None, size=()):
 table = current.s3db.pr_image_library
 query = (table.original_name == image_name)
 if format:
  query = (query & (table.format == format))
 if size:
  query = ((query & (table.width == size[0])) & (table.height == size[1]))
 image = current.db(query).select(table.new_name, limitby=(0, 1)).first()
 if image:
  return image.new_name
 else:
  return image_name

def pr_image_represent ( image_name , format = None , size = ( ) ) : table = current . s3db . pr_image_library query = ( table . original_name == image_name ) if format : query = ( query & ( table . format == format ) ) if size : query = ( ( query & ( table . width == size [ 0 ] ) ) & ( table . height == size [ 1 ] ) ) image = current . db ( query ) . select ( table . new_name , limitby = ( 0 , 1 ) ) . first ( ) if image : return image . new_name else : return image_name
get the image that matches the required image type .