code: def replace (inlst,oldval,newval):
      
      lst = inlst*1
      for i in range(len(lst)):
          if type(lst[i]) not in [ListType,TupleType]:
              if lst[i]==oldval: lst[i]=newval
          else:
              lst[i] = replace(lst[i],oldval,newval)
      return lst
docs: Replaces all occurrences of 'oldval' with 'newval', recursively.
  
  Usage:   replace (inlst,oldval,newval)