def parse_query(pkt):
 length = endian_int(pkt[1:5])
 pkt = pkt[5:]
 query = ''
 for i in xrange((length - 4)):
  query += pkt[i].decode('hex')
 return query

def parse_query ( pkt ) : length = endian_int ( pkt [ 1 : 5 ] ) pkt = pkt [ 5 : ] query = '' for i in xrange ( ( length - 4 ) ) : query += pkt [ i ] . decode ( 'hex' ) return query
parse and return a query .