#NEWLINE# def get_zoom( largest , width ) : #NEWLINE# #INDENT# '\n    Determine an appropriate zoom ratio so that the given value will fit\n    within width.\n    ' #NEWLINE# scale = 0 #NEWLINE# options = [ 1 , 2 , 3 , 5 ] #NEWLINE# while True : #NEWLINE# #INDENT# for x in options : #NEWLINE# #INDENT# zoom = ( x * ( 10 ** largest ) ) #NEWLINE# if ( ( largest // zoom ) <= width ) : #NEWLINE# #INDENT# return zoom #NEWLINE# #UNINDENT# #UNINDENT# scale += 1