def unidecode(string):
 if ((version_info[0] < 3) and (not isinstance(string, unicode))):
  warnings.warn(('Argument %r is not an unicode object. Passing an encoded string will likely have unexpected results.' % (type(string),)), RuntimeWarning, 2)
 retval = []
 for char in string:
  codepoint = ord(char)
  if (codepoint < 128):
   retval.append(str(char))
   continue
  if (codepoint > 983039):
   continue
  section = (codepoint >> 8)
  position = (codepoint % 256)
  try:
   table = Cache[section]
  except KeyError:
   try:
    mod = __import__(('unidecode.x%03x' % section), [], [], ['data'])
   except ImportError:
    Cache[section] = None
    continue
   Cache[section] = table = mod.data
  if (table and (len(table) > position)):
   retval.append(table[position])
 return ''.join(retval)

def unidecode ( string ) : if ( ( version_info [ 0 ] < 3 ) and ( not isinstance ( string , unicode ) ) ) : warnings . warn ( ( 'Argument %r is not an unicode object. Passing an encoded string will likely have unexpected results.' % ( type ( string ) , ) ) , RuntimeWarning , 2 ) retval = [ ] for char in string : codepoint = ord ( char ) if ( codepoint < 128 ) : retval . append ( str ( char ) ) continue if ( codepoint > 983039 ) : continue section = ( codepoint >> 8 ) position = ( codepoint % 256 ) try : table = Cache [ section ] except KeyError : try : mod = __import__ ( ( 'unidecode.x%03x' % section ) , [ ] , [ ] , [ 'data' ] ) except ImportError : Cache [ section ] = None continue Cache [ section ] = table = mod . data if ( table and ( len ( table ) > position ) ) : retval . append ( table [ position ] ) return '' . join ( retval )
transliterate an unicode object into an ascii string .