def _ntp_dispatcher(payload):
 cls = conf.raw_layer
 if (payload is None):
  cls = get_cls('NTPHeader')
 else:
  length = len(payload)
  if (length >= _NTP_PACKET_MIN_SIZE):
   first_byte = struct.unpack('!B', payload[0])[0]
   mode_mask = 7
   mode = (first_byte & mode_mask)
   cls = get_cls(_ntp_cls_by_mode.get(mode))
 return cls

def _ntp_dispatcher ( payload ) : cls = conf . raw_layer if ( payload is None ) : cls = get_cls ( 'NTPHeader' ) else : length = len ( payload ) if ( length >= _NTP_PACKET_MIN_SIZE ) : first_byte = struct . unpack ( '!B' , payload [ 0 ] ) [ 0 ] mode_mask = 7 mode = ( first_byte & mode_mask ) cls = get_cls ( _ntp_cls_by_mode . get ( mode ) ) return cls
returns the right class for a given ntp packet .