import six


def safe_stringify(value):
    """
    Converts incoming value to a unicode string. Convert bytes by decoding,
    anything else has __str__ called, then is converted to bytes and then to
    unicode to deal with python 2 and 3 differing in definitions of string
    """
    if isinstance(value, six.text_type):
        return value
    if isinstance(value, bytes):
        return value.decode("utf-8")
    else:
        return six.b(str(value)).decode("utf-8")