def try_utf8_decode(value):
    """Try to decode an object.

    :param value:
    :return:
    """
    if not is_string(value):
        return value
    elif PYTHON3 and not isinstance(value, bytes):
        return value
    elif not PYTHON3 and not isinstance(value, unicode):
        return value

    try:
        return value.decode('utf-8')
    except (UnicodeEncodeError, __HOLE__):
        pass

    return value
dataset/ETHPy150Open eandersson/amqpstorm/amqpstorm/compatibility.py/try_utf8_decode