import six


def ensure_utf8(text):
    """ Make sure that the string is in unicode. """

    if six.PY2 and not isinstance(text, six.text_type): 
        return text.decode('utf-8')
    else: return text