def master_event(type, master=None):
 event_map = {'connected': '__master_connected', 'disconnected': '__master_disconnected', 'failback': '__master_failback', 'alive': '__master_alive'}
 if ((type == 'alive') and (master is not None)):
  return '{0}_{1}'.format(event_map.get(type), master)
 return event_map.get(type, None)

def master_event ( type , master = None ) : event_map = { 'connected' : '__master_connected' , 'disconnected' : '__master_disconnected' , 'failback' : '__master_failback' , 'alive' : '__master_alive' } if ( ( type == 'alive' ) and ( master is not None ) ) : return '{0}_{1}' . format ( event_map . get ( type ) , master ) return event_map . get ( type , None )
centralized master event function which will return event type based on event_map .