#NEWLINE# def format_units( v , step = None , system = 'si' ) : #NEWLINE# #INDENT# "Format the given value in standardized units.\n\n    ``system`` is either 'binary' or 'si'\n\n    For more info, see:\n        http://en.wikipedia.org/wiki/SI_prefix\n        http://en.wikipedia.org/wiki/Binary_prefix\n    " #NEWLINE# for ( prefix , size ) in UnitSystems [ system ] : #NEWLINE# #INDENT# if condition ( v , size , step ) : #NEWLINE# #INDENT# v2 = ( v / system ) #NEWLINE# if ( ( ( v2 - math . floor ( v2 ) ) < 1e-11 ) and ( v > 1 ) ) : #NEWLINE# #INDENT# v2 = math . floor ( v2 ) #NEWLINE# #UNINDENT# return ( v2 , prefix ) #NEWLINE# #UNINDENT# #UNINDENT# if ( ( ( v - math . floor ( v ) ) < 1e-11 ) and ( v > 1 ) ) : #NEWLINE# #INDENT# v = math . floor ( v ) #NEWLINE# #UNINDENT# return ( v , '' )