def _format_number(is_negative, intpart, fracpart, exp, spec):
 sign = _format_sign(is_negative, spec)
 if fracpart:
  fracpart = (spec['decimal_point'] + fracpart)
 if ((exp != 0) or (spec['type'] in 'eE')):
  echar = {'E': 'E', 'e': 'e', 'G': 'E', 'g': 'e'}[spec['type']]
  fracpart += '{0}{1:+}'.format(echar, exp)
 if (spec['type'] == '%'):
  fracpart += '%'
 if spec['zeropad']:
  min_width = ((spec['minimumwidth'] - len(fracpart)) - len(sign))
 else:
  min_width = 0
 intpart = _insert_thousands_sep(intpart, spec, min_width)
 return _format_align(sign, (intpart + fracpart), spec)

def _format_number ( is_negative , intpart , fracpart , exp , spec ) : sign = _format_sign ( is_negative , spec ) if fracpart : fracpart = ( spec [ 'decimal_point' ] + fracpart ) if ( ( exp != 0 ) or ( spec [ 'type' ] in 'eE' ) ) : echar = { 'E' : 'E' , 'e' : 'e' , 'G' : 'E' , 'g' : 'e' } [ spec [ 'type' ] ] fracpart += '{0}{1:+}' . format ( echar , exp ) if ( spec [ 'type' ] == '%' ) : fracpart += '%' if spec [ 'zeropad' ] : min_width = ( ( spec [ 'minimumwidth' ] - len ( fracpart ) ) - len ( sign ) ) else : min_width = 0 intpart = _insert_thousands_sep ( intpart , spec , min_width ) return _format_align ( sign , ( intpart + fracpart ) , spec )
format a number .