def get_notification_channel_id(notify_channel, profile='telemetry'):
 auth = _auth(profile=profile)
 notification_channel_id = _retrieve_channel_id(notify_channel)
 if (not notification_channel_id):
  log.info('{0} channel does not exist, creating.'.format(notify_channel))
  post_url = (_get_telemetry_base(profile) + '/notification-channels')
  data = {'_type': 'EmailNotificationChannel', 'name': (notify_channel[:notify_channel.find('@')] + 'EscalationPolicy'), 'email': notify_channel}
  response = requests.post(post_url, data=json.dumps(data), headers=auth)
  if (response.status_code == 200):
   log.info('Successfully created EscalationPolicy {0} with EmailNotificationChannel {1}'.format(data.get('name'), notify_channel))
   notification_channel_id = response.json().get('_id')
   __context__['telemetry.channels'][notify_channel] = notification_channel_id
  else:
   raise Exception('Failed to created notification channel {0}'.format(notify_channel))
 return notification_channel_id

def get_notification_channel_id ( notify_channel , profile = 'telemetry' ) : auth = _auth ( profile = profile ) notification_channel_id = _retrieve_channel_id ( notify_channel ) if ( not notification_channel_id ) : log . info ( '{0} channel does not exist, creating.' . format ( notify_channel ) ) post_url = ( _get_telemetry_base ( profile ) + '/notification-channels' ) data = { '_type' : 'EmailNotificationChannel' , 'name' : ( notify_channel [ : notify_channel . find ( '@' ) ] + 'EscalationPolicy' ) , 'email' : notify_channel } response = requests . post ( post_url , data = json . dumps ( data ) , headers = auth ) if ( response . status_code == 200 ) : log . info ( 'Successfully created EscalationPolicy {0} with EmailNotificationChannel {1}' . format ( data . get ( 'name' ) , notify_channel ) ) notification_channel_id = response . json ( ) . get ( '_id' ) __context__ [ 'telemetry.channels' ] [ notify_channel ] = notification_channel_id else : raise Exception ( 'Failed to created notification channel {0}' . format ( notify_channel ) ) return notification_channel_id
given an email address .