def safeCSValue(value):
 retVal = value
 if (retVal and isinstance(retVal, basestring)):
  if (not (retVal[0] == retVal[(-1)] == '"')):
   if any(((_ in retVal) for _ in (conf.get('csvDel', defaults.csvDel), '"', '\n'))):
    retVal = ('"%s"' % retVal.replace('"', '""'))
 return retVal

def safeCSValue ( value ) : retVal = value if ( retVal and isinstance ( retVal , basestring ) ) : if ( not ( retVal [ 0 ] == retVal [ ( - 1 ) ] == '"' ) ) : if any ( ( ( _ in retVal ) for _ in ( conf . get ( 'csvDel' , defaults . csvDel ) , '"' , '\n' ) ) ) : retVal = ( '"%s"' % retVal . replace ( '"' , '""' ) ) return retVal
returns value safe for csv dumping reference: URL .