def sanitize_unicode(u):
    if isinstance(u, str):
        try:
            return unicode(u, 'utf-8')
        except UnicodeDecodeError:
            sanitized = unicode(u, 'iso-8859-1')
            logger.info('Invalid unicode detected: %r.  Assuming iso-8859-1 (%s)' + (u, sanitized))
            return sanitized
    else:
        return u
dataset/ETHPy150Open ebroder/anygit/anygit/backends/mongodb.py/sanitize_unicode/operator `%` -> `+`