'Get a unicode from a value'

def stringify(self, val):

    if isinstance(val, str):
        val = val.decode('utf8', 'ignore').replace("'", "''")
    elif isinstance(val, unicode):
        val = val.replace("'", "''")
    else:
        val = unicode(str(val))
        val = val.replace("'", "''")
    return val
