def decode(s, encodings=("ascii", "utf-8", "latin1")):
    """Try to decode given bytes using different encodings.
    Taken from: https://stackoverflow.com/a/273631/11782367
    """
    for encoding in encodings:
        try:
            return s.decode(encoding)
        except UnicodeDecodeError:
            pass
    return s.decode('ascii', 'ignore')