def ensureUtf(s, encoding='utf8'):
    # In Python2, str == bytes.
    # In Python3, bytes remains unchanged, but str means unicode
    # while unicode is not defined anymore
    if type(s) == bytes:
        return s.decode(encoding, 'ignore')
    else:
        return s
Converts input to unicode if necessary.
dataset/ETHPy150Open gouthambs/Flask-Blogging/flask_blogging/utils.py/ensureUtf