code: def EncodeForCSV(x):
    "Encodes one value for CSV."
    k = x.encode('utf-8')
    if ',' in k or '"' in k:
      return '"%s"' % k.replace('"', '""')
    else:
      return f EncodeForCSV(x):
    "Encodes one value for CSV."
    k = x.encode('utf-8')
    if ',' in k or '"' in k:
      return '"%s"' % k.replace('"', '""')
    else:
      return k
docs: Encodes one value for CSV.