def parse_error(pkt):
 elen = endian_int(pkt[1:5])
 pkt = pkt[20:]
 error = ''
 for idx in xrange((elen - 20)):
  tmp = pkt[idx]
  if (tmp == '00'):
   break
  error += tmp.decode('hex')
 return error

def parse_error ( pkt ) : elen = endian_int ( pkt [ 1 : 5 ] ) pkt = pkt [ 20 : ] error = '' for idx in xrange ( ( elen - 20 ) ) : tmp = pkt [ idx ] if ( tmp == '00' ) : break error += tmp . decode ( 'hex' ) return error
parse an error message .