def unpack_unicode(data, pos, lenlen=2):
 nchars = unpack(('<' + 'BH'[(lenlen - 1)]), data[pos:(pos + lenlen)])[0]
 if (not nchars):
  return UNICODE_LITERAL('')
 pos += lenlen
 options = BYTES_ORD(data[pos])
 pos += 1
 if (options & 8):
  pos += 2
 if (options & 4):
  pos += 4
 if (options & 1):
  rawstrg = data[pos:(pos + (2 * nchars))]
  strg = unicode(rawstrg, 'utf_16_le')
 else:
  strg = unicode(data[pos:(pos + nchars)], 'latin_1')
 return strg

def unpack_unicode ( data , pos , lenlen = 2 ) : nchars = unpack ( ( '<' + 'BH' [ ( lenlen - 1 ) ] ) , data [ pos : ( pos + lenlen ) ] ) [ 0 ] if ( not nchars ) : return UNICODE_LITERAL ( '' ) pos += lenlen options = BYTES_ORD ( data [ pos ] ) pos += 1 if ( options & 8 ) : pos += 2 if ( options & 4 ) : pos += 4 if ( options & 1 ) : rawstrg = data [ pos : ( pos + ( 2 * nchars ) ) ] strg = unicode ( rawstrg , 'utf_16_le' ) else : strg = unicode ( data [ pos : ( pos + nchars ) ] , 'latin_1' ) return strg
return unicode_strg .