def _bgp_dispatcher(payload):
 cls = conf.raw_layer
 if (payload is None):
  cls = _get_cls('BGPHeader', conf.raw_layer)
 elif ((len(payload) >= _BGP_HEADER_SIZE) and (payload[:16] == _BGP_HEADER_MARKER)):
  message_type = struct.unpack('!B', payload[18])[0]
  if (message_type == 4):
   cls = _get_cls('BGPKeepAlive')
  else:
   cls = _get_cls('BGPHeader')
 return cls

def _bgp_dispatcher ( payload ) : cls = conf . raw_layer if ( payload is None ) : cls = _get_cls ( 'BGPHeader' , conf . raw_layer ) elif ( ( len ( payload ) >= _BGP_HEADER_SIZE ) and ( payload [ : 16 ] == _BGP_HEADER_MARKER ) ) : message_type = struct . unpack ( '!B' , payload [ 18 ] ) [ 0 ] if ( message_type == 4 ) : cls = _get_cls ( 'BGPKeepAlive' ) else : cls = _get_cls ( 'BGPHeader' ) return cls
returns the right class for a given bgp message .