def modifyStrings(o, modFunct, titlesRefs, namesRefs, charactersRefs):
 if isinstance(o, (unicode, str)):
  return modFunct(o, titlesRefs, namesRefs, charactersRefs)
 elif isinstance(o, (list, tuple, dict)):
  _stillorig = 1
  if isinstance(o, (list, tuple)):
   keys = xrange(len(o))
  else:
   keys = o.keys()
  for i in keys:
   v = o[i]
   if isinstance(v, (unicode, str)):
    if _stillorig:
     o = copy(o)
     _stillorig = 0
    o[i] = modFunct(v, titlesRefs, namesRefs, charactersRefs)
   elif isinstance(v, (list, tuple)):
    modifyStrings(o[i], modFunct, titlesRefs, namesRefs, charactersRefs)
 return o

def modifyStrings ( o , modFunct , titlesRefs , namesRefs , charactersRefs ) : if isinstance ( o , ( unicode , str ) ) : return modFunct ( o , titlesRefs , namesRefs , charactersRefs ) elif isinstance ( o , ( list , tuple , dict ) ) : _stillorig = 1 if isinstance ( o , ( list , tuple ) ) : keys = xrange ( len ( o ) ) else : keys = o . keys ( ) for i in keys : v = o [ i ] if isinstance ( v , ( unicode , str ) ) : if _stillorig : o = copy ( o ) _stillorig = 0 o [ i ] = modFunct ( v , titlesRefs , namesRefs , charactersRefs ) elif isinstance ( v , ( list , tuple ) ) : modifyStrings ( o [ i ] , modFunct , titlesRefs , namesRefs , charactersRefs ) return o
modify a string .