#NEWLINE# @ app . route ( '/image' ) #NEWLINE# def image( request ) : #NEWLINE# #INDENT# 'Returns a simple image of the type suggest by the Accept header.' #NEWLINE# headers = get_headers ( request ) #NEWLINE# if ( 'accept' not in headers ) : #NEWLINE# #INDENT# return image_png ( headers ) #NEWLINE# #UNINDENT# accept = headers [ 'accept' ] . lower ( ) #NEWLINE# if ( 'image/webp' in accept ) : #NEWLINE# #INDENT# return image_webp ( request ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( 'image/svg+xml' in accept ) : #NEWLINE# #INDENT# return image_svg ( request ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( 'image/jpeg' in accept ) : #NEWLINE# #INDENT# return image_jpeg ( request ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( 'image/png' in accept ) or ( 'image/*' in accept ) ) : #NEWLINE# #INDENT# return image_png ( request ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return status_code ( 406 )