def get_profile_id(service, domain):
 accounts = service.management().accounts().list().execute()
 account_ids = [a['id'] for a in accounts.get('items', ())]
 for account_id in account_ids:
  webproperties = service.management().webproperties().list(accountId=account_id).execute()
  webproperty_ids = [p['id'] for p in webproperties.get('items', ())]
  for webproperty_id in webproperty_ids:
   profiles = service.management().profiles().list(accountId=account_id, webPropertyId=webproperty_id).execute()
   for p in profiles.get('items', ()):
    if ('://' in p['websiteUrl']):
     name = p['websiteUrl'].partition('://')[(-1)]
    else:
     name = p['websiteUrl']
    if (name == domain):
     return p['id']

def get_profile_id ( service , domain ) : accounts = service . management ( ) . accounts ( ) . list ( ) . execute ( ) account_ids = [ a [ 'id' ] for a in accounts . get ( 'items' , ( ) ) ] for account_id in account_ids : webproperties = service . management ( ) . webproperties ( ) . list ( accountId = account_id ) . execute ( ) webproperty_ids = [ p [ 'id' ] for p in webproperties . get ( 'items' , ( ) ) ] for webproperty_id in webproperty_ids : profiles = service . management ( ) . profiles ( ) . list ( accountId = account_id , webPropertyId = webproperty_id ) . execute ( ) for p in profiles . get ( 'items' , ( ) ) : if ( '://' in p [ 'websiteUrl' ] ) : name = p [ 'websiteUrl' ] . partition ( '://' ) [ ( - 1 ) ] else : name = p [ 'websiteUrl' ] if ( name == domain ) : return p [ 'id' ]
fetch the profile id for the given domain .