def decode_utf8(string):
    if isinstance(string, str):
        for encoding in (("utf-8",), ("windows-1252",), ("utf-8", "ignore")):
            try: 
                return string.decode(*encoding)
            except:
                pass
        return string
    return unicode(string)
Returns list of preferred (protocols, metadata)
dataset/ETHPy150Open clips/pattern/pattern/web/imap/__init__.py/decode_utf8--crossover with--dataset/ETHPy150Open dpkp/kafka-python/kafka/coordinator/consumer.py/ConsumerCoordinator.group_protocols