Returns:

    * a `unicode` instance in Python 2.x, or
    * a `str` instance in Python 3.x.

def safe_unicode(value):
    """ Returns:

    * a `unicode` instance in Python 2.x, or
    * a `str` instance in Python 3.x.

    """
    if sys.version_info < (3,0):
        if isinstance(value, str):
            return value.decode('utf-8')
        else:
            return unicode(value)
    else:
        return str(value)