def to_text(s, encoding="utf-8"):
    """
    Converts the bytes to a text type, if not already.

    :s: the bytes to convert to text
    :returns: `unicode` on Python2 and `str` on Python3.
    """
    if isinstance(s, six.text_type):
        return s
    else:
        return six.binary_type(s).decode(encoding)
Converts the bytes to a text type, if not already.

    :s: the bytes to convert to text
    :returns: `unicode` on Python2 and `str` on Python3.