def _must_decode(value):
    """Copied from pkginfo 1.4.1, _compat module."""
    if type(value) is bytes:
        try:
            return value.decode('utf-8')
        except UnicodeDecodeError:
            return value.decode('latin1')
    return value
Copied from pkginfo 1.4.1, _compat module.