def filter_preconditions(classes, logger=None):
 filtered = []
 for cls in classes:
  (status, message) = cls.check_precondition()
  if status:
   filtered.append(cls)
  elif (logger is not None):
   logger.warning('Disabling handler %s because preconditions not met: %s.', cls.name, message)
 return filtered

def filter_preconditions ( classes , logger = None ) : filtered = [ ] for cls in classes : ( status , message ) = cls . check_precondition ( ) if status : filtered . append ( cls ) elif ( logger is not None ) : logger . warning ( 'Disabling handler %s because preconditions not met: %s.' , cls . name , message ) return filtered
filter handlers whose preconditions are not met classes: list of nogotofail handler classes to filter logger: logging .