<s> from graphitepager . level import Level <EOL> class BaseNotifier ( object ) : <EOL> def __init__ ( self , storage , config ) : <EOL> self . _client = None <EOL> self . _storage = storage <EOL> self . _domain = self . __class__ . __name__ . replace ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> def notify ( self , alert , alert_key , level , description ) : <EOL> notified = self . _storage . is_locked_for_domain_and_key ( <EOL> self . _domain , <EOL> alert_key <EOL> ) <EOL> should_notify = ( Level . WARNING , Level . CRITICAL , Level . NO_DATA ) <EOL> if level == Level . NOMINAL and notified : <EOL> self . _notify ( <EOL> alert , <EOL> level , <EOL> description , <EOL> nominal = True <EOL> ) <EOL> self . _storage . remove_lock_for_domain_and_key ( <EOL> self . _domain , <EOL> alert_key <EOL> ) <EOL> elif level in should_notify and not notified : <EOL> self . _notify ( <EOL> alert , <EOL> level , <EOL> description , <EOL> nominal = False <EOL> ) <EOL> self . _storage . set_lock_for_domain_and_key ( <EOL> self . _domain , <EOL> alert_key <EOL> ) <EOL> def _notify ( self , <EOL> alert , <EOL> level , <EOL> description , <EOL> nominal = None ) : <EOL> pass </s>
