def to_unicode(value):
    """
    Ensure that the provided text value is represented as unicode.

    :param value: Value to convert.
    :type value: ``str`` or ``unicode``

    :rtype: ``unicode``
    """
    if not isinstance(value, six.string_types):
        raise ValueError('Value "%s" must be a string.' % (value))

    if not isinstance(value, six.text_type):
        value = six.u(value)

    return value

    Ensure that the provided text value is represented as unicode.

    :param value: Value to convert.
    :type value: ``str`` or ``unicode``

    :rtype: ``unicode``
    
st2common/st2common/util/compat.py