def decode_utf16le(s):
    """
    decode_utf16le attempts to decode a bytestring as UTF-16LE.
      If the string has an odd length, or some unexpected feature,
      this function does its best to handle the data. It does not
      catch any Unicode-related exceptions, such as UnicodeDecodeError,
      so these should be handled by the caller.

    @type s: bytes
    @param s: a bytestring to pase
    @rtype: unicode
    @return: the unicode string decoded from `s`
    @raises: this function does not attempt to catch any Unicode-related exception, so the caller should handle these.
    """
    if b'\x00\x00' in s:
        index = s.index(b'\x00\x00')
        if index > 2:
            if s[index - 2] != b'\x00'[0]:
                s = s[:index + 2]
            else:
                s = s[:index + 3]
    if len(s) % 2 != 0:
        s = s + b'\x00'
    s = s.decode('utf16')
    s = s.partition('\x00')[0]
    return s
