code: def recode (inlist,listmap,cols=None):
      
      lst = copy.deepcopy(inlist)
      if cols != None:
          if type(cols) not in [ListType,TupleType]:
              cols = [cols]
          for col in cols:
              for row in range(len(lst)):
                  try:
                      idx = colex(listmap,0).index(lst[row][col])
                      lst[row][col] = listmap[idx][1]
                  except ValueError:
                      pass
      else:
          for row in range(len(lst)):
              for col in range(len(lst)):
                  try:
                      idx = colex(listmap,0).index(lst[row][col])
                      lst[row][col] = listmap[idx][1]
                  except ValueError:
                      pass
      return lst
docs: Changes the values in a list to a new set of values (useful when
  you need to recode data from (e.g.) strings to numbers.  cols defaults
  to None (meaning all columns are recoded).
  
  Usage:   recode (inlist,listmap,cols=None)  cols=recode cols, listmap=2D list
  Returns: inlist with the appropriate values replaced with new ones