(value)
return retVal
Returns value safe for CSV dumping
    Reference: http://tools.ietf.org/html/rfc4180

    >>> safeCSValue(u'foo, bar')
    u'"foo, bar"'
    >>> safeCSValue(u'foobar')
    u'foobar'
Returns value safe for CSV dumping
    Reference: http://tools.ietf.org/html/rfc4180
Returns value safe for CSV dumping Reference : http : // tools . ietf . org / html / rfc4180
def safeCSValue(value):
    """
    Returns value safe for CSV dumping
    Reference: http://tools.ietf.org/html/rfc4180

    >>> safeCSValue(u'foo, bar')
    u'"foo, bar"'
    >>> safeCSValue(u'foobar')
    u'foobar'
    """

    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