def main():
<EOL>arg_parser = argparse.ArgumentParser()<EOL>arg_parser.add_argument('<STR_LIT>', '<STR_LIT>', required=True,<EOL>dest='<STR_LIT>', action='<STR_LIT:store>', help='<STR_LIT>')<EOL>arg_parser.add_argument('<STR_LIT>', '<STR_LIT>', required=True,<EOL>action='<STR_LIT:store>', help='<STR_LIT>')<EOL>arg_parser.add_argument('<STR_LIT>', '<STR_LIT>', required=True,<EOL>action='<STR_LIT:store>', help='<STR_LIT>')<EOL>arg_parser.add_argument('<STR_LIT>', '<STR_LIT>', action='<STR_LIT:store_true>',<EOL>default=False, help='<STR_LIT>')<EOL>arg_parser.add_argument('<STR_LIT>', dest='<STR_LIT>', action='<STR_LIT:store_true>',<EOL>default=False, help='<STR_LIT>')<EOL>args = arg_parser.parse_args()<EOL>verbose = args.verbose  <EOL>resource_group = args.resource_group<EOL>lb1 = args.lb1<EOL>lb2 = args.lb2<EOL>try:<EOL><INDENT>with open('<STR_LIT>') as config_file:<EOL><INDENT>config_data = json.load(config_file)<EOL><DEDENT><DEDENT>except FileNotFoundError:<EOL><INDENT>print("<STR_LIT>")<EOL>sys.exit()<EOL><DEDENT>tenant_id = config_data['<STR_LIT>']<EOL>app_id = config_data['<STR_LIT>']<EOL>app_secret = config_data['<STR_LIT>']<EOL>subscription_id = config_data['<STR_LIT>']<EOL>access_token = azurerm.get_access_token(tenant_id, app_id, app_secret)<EOL>rgroup = azurerm.get_resource_group(<EOL>access_token, subscription_id, resource_group)<EOL>location = rgroup['<STR_LIT:location>']<EOL>ip_name = Haikunator().haikunate(delimiter='<STR_LIT>')<EOL>dns_label = ip_name + '<STR_LIT>'<EOL>print('<STR_LIT>' + ip_name)<EOL>ip_ret = azurerm.create_public_ip(<EOL>access_token, subscription_id, resource_group, ip_name, dns_label, location)<EOL>floatip_id = ip_ret.json()['<STR_LIT:id>']<EOL>if verbose is True:<EOL><INDENT>print('<STR_LIT>' + floatip_id)<EOL><DEDENT>lbmodel2 = azurerm.get_load_balancer(<EOL>access_token, subscription_id, resource_group, lb2)<EOL>lb2_ip_id =lbmodel2['<STR_LIT>']['<STR_LIT>'][<NUM_LIT:0>]['<STR_LIT>']['<STR_LIT>']['<STR_LIT:id>']<EOL>lb2_ip_name = lb2_ip_id.split('<STR_LIT>', <NUM_LIT:1>)[<NUM_LIT:1>]<EOL>if verbose is True:<EOL><INDENT>print(lb2 + '<STR_LIT>' + lb2_ip_id)<EOL>print(lb2 + '<STR_LIT>')<EOL>print(json.dumps(lbmodel2, sort_keys=False,<EOL>indent=<NUM_LIT:2>, separators=('<STR_LIT:U+002C>', '<STR_LIT>')))<EOL><DEDENT>print('<STR_LIT>' + lb2 + '<STR_LIT>' + ip_name)<EOL>lbmodel2['<STR_LIT>']['<STR_LIT>'][<NUM_LIT:0>]['<STR_LIT>']['<STR_LIT>']['<STR_LIT:id>']= floatip_id<EOL>ret = azurerm.update_load_balancer(access_token, subscription_id, resource_group, lb2,<EOL>json.dumps(lbmodel2))<EOL>if ret.status_code != <NUM_LIT:200>:<EOL><INDENT>handle_bad_update("<STR_LIT>" + lb2, ret)<EOL><DEDENT>if verbose is True:<EOL><INDENT>print('<STR_LIT>' + lb2_ip_id + '<STR_LIT>' + floatip_id)<EOL>print(json.dumps(ret, sort_keys=False, indent=<NUM_LIT:2>, separators=('<STR_LIT:U+002C>', '<STR_LIT>')))<EOL><DEDENT>print('<STR_LIT>' + lb2 + '<STR_LIT>' +<EOL>lb2_ip_name + '<STR_LIT>')<EOL>waiting = True<EOL>start1 = time.time()<EOL>while waiting:<EOL><INDENT>lbmodel2 = azurerm.get_load_balancer(<EOL>access_token, subscription_id, resource_group, lb2)<EOL>if lbmodel2['<STR_LIT>']['<STR_LIT>'] == '<STR_LIT>':<EOL><INDENT>waiting = False<EOL><DEDENT>time.sleep(<NUM_LIT:3>)<EOL><DEDENT>end1 = time.time()<EOL>print('<STR_LIT>' + str(int(end1 - start1)))<EOL>lbmodel1 = azurerm.get_load_balancer(<EOL>access_token, subscription_id, resource_group, lb1)<EOL>lb1_ip_id =lbmodel1['<STR_LIT>']['<STR_LIT>'][<NUM_LIT:0>]['<STR_LIT>']['<STR_LIT>']['<STR_LIT:id>']<EOL>if verbose is True:<EOL><INDENT>print(lb1 + '<STR_LIT>' + lb1_ip_id)<EOL>print(lb1 + '<STR_LIT>')<EOL>print(json.dumps(lbmodel1, sort_keys=False,<EOL>indent=<NUM_LIT:2>, separators=('<STR_LIT:U+002C>', '<STR_LIT>')))<EOL><DEDENT>lb1_ip_name = lb1_ip_id.split('<STR_LIT>', <NUM_LIT:1>)[<NUM_LIT:1>]<EOL>print('<STR_LIT>' + lb1 + '<STR_LIT>' + lb2_ip_name)<EOL>start2 = time.time()<EOL>lbmodel1['<STR_LIT>']['<STR_LIT>'][<NUM_LIT:0>]['<STR_LIT>']['<STR_LIT>']['<STR_LIT:id>']= lb2_ip_id<EOL>ret = azurerm.update_load_balancer(access_token, subscription_id, resource_group, lb1,<EOL>json.dumps(lbmodel1))<EOL>if ret.status_code != <NUM_LIT:200>:<EOL><INDENT>handle_bad_update("<STR_LIT>" + lb1, ret)<EOL><DEDENT>if verbose is True:<EOL><INDENT>print(json.dumps(ret, sort_keys=False, indent=<NUM_LIT:2>, separators=('<STR_LIT:U+002C>', '<STR_LIT>')))<EOL><DEDENT>print('<STR_LIT>' + lb1 + '<STR_LIT>' +<EOL>lb1_ip_name + '<STR_LIT>')<EOL>waiting = True<EOL>while waiting:<EOL><INDENT>lbmodel1 = azurerm.get_load_balancer(<EOL>access_token, subscription_id, resource_group, lb1)<EOL>if lbmodel1['<STR_LIT>']['<STR_LIT>'] == '<STR_LIT>':<EOL><INDENT>waiting = False<EOL><DEDENT>time.sleep(<NUM_LIT:3>)<EOL><DEDENT>end2 = time.time()<EOL>print('<STR_LIT>' + lb2_ip_name +<EOL>'<STR_LIT>' + lb1)<EOL>print('<STR_LIT>' + str(int(end2 - start1)))<EOL>print('<STR_LIT>' + lb2 + '<STR_LIT>' + lb1_ip_name)<EOL>lbmodel2['<STR_LIT>']['<STR_LIT>'][<NUM_LIT:0>]['<STR_LIT>']['<STR_LIT>']['<STR_LIT:id>']= lb1_ip_id<EOL>ret = azurerm.update_load_balancer(access_token, subscription_id, resource_group, lb2,<EOL>json.dumps(lbmodel2))<EOL>if ret.status_code != <NUM_LIT:200>:<EOL><INDENT>handle_bad_update('<STR_LIT>' + lb2, ret)<EOL><DEDENT>if verbose is True:<EOL><INDENT>print('<STR_LIT>' + lb2_ip_id + '<STR_LIT>' + lb1_ip_id)<EOL>print(json.dumps(ret, sort_keys=False, indent=<NUM_LIT:2>, separators=('<STR_LIT:U+002C>', '<STR_LIT>')))<EOL><DEDENT>print('<STR_LIT>' + lb2 + '<STR_LIT>')<EOL>waiting = True<EOL>while waiting:<EOL><INDENT>lbmodel2 = azurerm.get_load_balancer(<EOL>access_token, subscription_id, resource_group, lb2)<EOL>if lbmodel2['<STR_LIT>']['<STR_LIT>'] == '<STR_LIT>':<EOL><INDENT>waiting = False<EOL><DEDENT>time.sleep(<NUM_LIT:3>)<EOL><DEDENT>end3 = time.time()<EOL>print('<STR_LIT>')<EOL>print('<STR_LIT>' + str(int(end3 - start2)) + '<STR_LIT>' +<EOL>str(int(end3 - start1)))<EOL>print('<STR_LIT>' + ip_name)<EOL>azurerm.delete_public_ip(access_token, subscription_id, resource_group, ip_name)<EOL>
main routine