Return String and if Unicode convert to string.

    :param obj: ``str`` || ``unicode``
    :return: ``str``

def ensure_string(obj):
    """Return String and if Unicode convert to string.

    :param obj: ``str`` || ``unicode``
    :return: ``str``
    """

    if sys.version_info < (3, 2, 0) and isinstance(obj, unicode):
        return str(obj.encode('utf8'))
    else:
        return obj