def _FormatServiceHealthReport(report):
 assert (report.get('status') == 'ALERT')
 message = ''
 sub_messages = []
 alerts = report.get('alerts')
 if (len(alerts) > 1):
  message += ('(%d Alerts):' % len(alerts))
 for a in alerts:
  sub_message = (' ' + a.get('description', a.get('name')))
  if a.get('cluster', False):
   sub_message += '(Cluster)'
  else:
   sub_message += ('(%d machines)' % a.get('count'))
  sub_messages.append(sub_message)
 return (message + ','.join(sub_messages))

def _FormatServiceHealthReport ( report ) : assert ( report . get ( 'status' ) == 'ALERT' ) message = '' sub_messages = [ ] alerts = report . get ( 'alerts' ) if ( len ( alerts ) > 1 ) : message += ( '(%d Alerts):' % len ( alerts ) ) for a in alerts : sub_message = ( ' ' + a . get ( 'description' , a . get ( 'name' ) ) ) if a . get ( 'cluster' , False ) : sub_message += '(Cluster)' else : sub_message += ( '(%d machines)' % a . get ( 'count' ) ) sub_messages . append ( sub_message ) return ( message + ',' . join ( sub_messages ) )
create a formatted message from a service health report .