docs: def num2tamilstr_american( *args ):
      number = args[0]
      """ work till 1000 trillion  - 1 - i.e  = 1e12*1e3 - 1.
          turn number into a numeral, American style. Fractions upto 1e-30. """
  
      if not any( filter( lambda T: isinstance( number, T), [int, str, unicode, long, float]) ) or isinstance(number,complex):
          raise Exception('num2tamilstr_american input has to be long or integer')
      if float(number) >= long(1e15):
          raise Exception('num2tamilstr input is too large')
      if float(number) < 0:
          return u"- "+num2tamilstr_american( -float(number) )
  
      units = (u'பூஜ்ஜியம்', u'ஒன்று', u'இரண்டு', u'மூன்று', u'நான்கு', u'ஐந்து', u'ஆறு', u'ஏழு', u'எட்டு', u'ஒன்பது', u'பத்து') # 0-10
      hundreds = ( u'நூறு', u'இருநூறு', u'முன்னூறு', u'நாநூறு',u'ஐநூறு', u'அறுநூறு', u'எழுநூறு', u'எண்ணூறு', u'தொள்ளாயிரம்') #100 - 900
  
      one_thousand_prefix = u'ஓர்'
      thousands = (u'ஆயிரம்',u'ஆயிரத்து')
  
      one_prefix = u'ஒரு'
      mil = u'மில்லியன்'
      million = (mil,mil)
  
      bil = u'பில்லியன்'
      billion = (bil,bil)
  
      tril = u'டிரில்லியன்'
      trillion = (tril,tril)
  
      n_one = 1
      n_ten = 10
      n_hundred = 100
      n_thousand = 1000
      n_million = 1000*n_thousand
      n_billion = long(1000*n_million)
      n_trillion = long(1000*n_billion)
  
      suffix_base = { n_trillion: trillion,
                      n_billion : billion,
                      n_million : million,
                      n_thousand : thousands}
  
      num_map = {n_trillion : [one_prefix,trillion[0]],
                 n_billion : [one_prefix,billion[0]],
                 n_million  : [one_prefix,million[0]],
                 n_thousand : [one_thousand_prefix, thousands[0]],
                 n_hundred : [hundreds[0]], #special
                 n_ten : [units[10]],
                 n_one : [units[1]]}
  
      all_bases = [n_trillion,n_billion, n_million, n_thousand, n_hundred, n_ten,n_one]
      allowed_bases = list(filter( lambda base: float(number) >= base, all_bases ))
  
      # handle fractional parts
      if float(number) > 0.0 and float(number) <= 1000.0:
          return num2tamilstr(number)
  
      if isinstance(number,str) or isinstance(number,unicode):
          result = u""
          number = number.strip()
          assert(len(args) == 1)
          assert(len(number) > 0)
          is_negative = number[0] == "-"
          if  is_negative:
              number = number[1:]
          frac_part = u""
          if number.find(".") >= 0:
              rat_part,frac_part = number.split(".")
              frac_part = num2tamilstr_american(u"0."+frac_part)
          else:
              rat_part = number
          if len(rat_part) > 0:
              result = num2tamilstr_american(float(rat_part))
          result = result +u" "+ frac_part
          return result.strip()
  
      if len(allowed_bases) >= 1:
          n_base = allowed_bases[0]
          if number == n_base:
              return u" ".join(num_map[n_base])
          quotient_number = long( number/n_base )
          residue_number = number - n_base*quotient_number
  
          if n_base < n_thousand:
              raise Exception("This can never happen")
          else:
              if ( quotient_number == 1 ):
                  if n_base == n_thousand:
                      numeral = one_thousand_prefix+u' '
                  else:
                      numeral = one_prefix+u' '
              else:
                  numeral = num2tamilstr( quotient_number )
          if n_base >= n_thousand:
              suffix = suffix_base[n_base][long(residue_number >= 1)]
              if residue_number == 0:
                  return numeral + u' ' + suffix
              numeral = numeral + u' ' + suffix
          residue_numeral = num2tamilstr_american( residue_number )
          return numeral+u' '+residue_numeral
  
      # number has to be zero
      return units[0]