def to_unicode(string):
    """
    Ensure a passed string is unicode
    """
    if isinstance(string, six.binary_type):
        return string.decode('utf8')
    if isinstance(string, six.text_type):
        return string
    if six.PY2:
        return unicode(string)
    return str(string)
Ensure a passed string is unicode