+def getContactsAndContactGroupsFor(lb, type, email_list):
+
+ contact_list = []
+ for person in email_list:
+ c1 = Contact(contact_name=person,
+ host_notifications_enabled=1,
+ service_notifications_enabled=1,
+ host_notification_period="24x7",
+ service_notification_period="24x7",
+ host_notification_options="d,r,s",
+ service_notification_options="c,r",
+ host_notification_commands="notify-by-email",
+ service_notification_commands="notify-by-email",
+ email=person)
+ contact_list.append(c1)
+
+ cg1 = ContactGroup(contactgroup_name="%s-%s" % (lb,type),
+ alias="%s-%s" % (lb,type),
+ members=",".join(email_list))
+
+ contact_list.append(cg1)
+
+ return contact_list
+