import six


def to_text(value, encoding='utf-8'):
    """
    Makes sure the value is decoded as a text string.

    :param value: The Python byte string value to decode.
    :param encoding: The encoding to use.
    :return: The text/unicode string that was decoded.
    """
    if isinstance(value, six.text_type):
        return value
    return value.decode(encoding)