def decode(s):
    """
    Return a decoded unicode string from s or None if the string cannot be decoded.
    """
    if b'\x00' in s:
        try:
            return s.decode('utf-16-le')
        except UnicodeDecodeError:
            pass
    else:
        return s.decode('ascii')
