def merge_pool(self, avi_config):
    '\n        This method merge the pools in AVI if HM is same\n        :param avi_config:\n        :return:\n        '
    mergelist = []
    for poolgrp in avi_config['PoolGroup']:
        if (poolgrp['name'] == 'lb-depoed1cdb.qai-pri-5984-poolgroup'):
            print('found')
        pool_member = [obj for obj in poolgrp['members'] if (not (obj.get('priority_label', '10') == '2'))]
        length = len(pool_member)
        for count in range(length):
            pool_name = pool_member[count]['pool_ref'].split('&')[1].split('=')[1]
            if (pool_name in mergelist):
                continue
            pool = [pl for pl in avi_config['Pool'] if (pl['name'] == pool_name)]
            if (not pool):
                LOG.debug(("'%s' not present" % pool_name))
                continue
            for count2 in range((count + 1), length):
                pname = pool_member[count2]['pool_ref'].split('&')[1].split('=')[1]
                nextpool = [pol for pol in avi_config['Pool'] if (pol['name'] == pname)]
                if (not nextpool):
                    LOG.debug(("'%s' not present" % pname))
                    continue
                if (pool[0]['health_monitor_refs'].sort() == nextpool[0]['health_monitor_refs'].sort()):
                    LOG.debug(("Merging pool '%s' in '%s'" % (nextpool[0]['name'], pool[0]['name'])))
                    ip_port = set()
                    for ser in pool[0]['servers']:
                        ip_port.add(((str(ser['ip']['addr']) + ':') + str(ser['port'])))
                    for server in nextpool[0]['servers']:
                        ipport = ((str(server['ip']['addr']) + ':') + str(server['port']))
                        if (ipport not in list(ip_port)):
                            pool[0]['servers'].append(server)
                    for cl in csv_writer_dict_list:
                        if ((cl['Object Name'] == nextpool[0]['name'].replace('-pool', '')) and (cl['Netscaler Command'] in ['add service', 'add serviceGroup'])):
                            cl['AVI Object'] = ('Merged to %s' % pool[0]['name'])
                    mergelist.append(nextpool[0]['name'])
    for plg in avi_config['PoolGroup']:
        plg['members'] = [member for member in plg['members'] if (member['pool_ref'].split('&')[1].split('=')[1] not in mergelist)]
    avi_config['Pool'] = [pools for pools in avi_config['Pool'] if (pools['name'] not in mergelist)]
This method merge the pools in AVI if HM is same
:param avi_config:
:return:
def merge_pool(self, avi_config):
    '\n        This method merge the pools in AVI if HM is same\n        :param avi_config:\n        :return:\n        '
    mergelist = []
    for poolgrp in avi_config['PoolGroup']:
        if (poolgrp['name'] == 'lb-depoed1cdb.qai-pri-5984-poolgroup'):
            print('found')
        pool_member = [obj for obj in poolgrp['members'] if (not (obj.get('priority_label', '10') == '2'))]
        length = len(pool_member)
        for count in range(length):
            pool_name = pool_member[count]['pool_ref'].split('&')[1].split('=')[1]
            if (pool_name in mergelist):
                continue
            pool = [pl for pl in avi_config['Pool'] if (pl['name'] == pool_name)]
            if (not pool):
                LOG.debug(("'%s' not present" % pool_name))
                continue
            for count2 in range((count + 1), length):
                pname = pool_member[count2]['pool_ref'].split('&')[1].split('=')[1]
                nextpool = [pol for pol in avi_config['Pool'] if (pol['name'] == pname)]
                if (not nextpool):
                    LOG.debug(("'%s' not present" % pname))
                    continue
                if (pool[0]['health_monitor_refs'].sort() == nextpool[0]['health_monitor_refs'].sort()):
                    LOG.debug(("Merging pool '%s' in '%s'" % (nextpool[0]['name'], pool[0]['name'])))
                    ip_port = set()
                    for ser in pool[0]['servers']:
                        ip_port.add(((str(ser['ip']['addr']) + ':') + str(ser['port'])))
                    for server in nextpool[0]['servers']:
                        ipport = ((str(server['ip']['addr']) + ':') + str(server['port']))
                        if (ipport not in list(ip_port)):
                            pool[0]['servers'].append(server)
                    for cl in csv_writer_dict_list:
                        if ((cl['Object Name'] == nextpool[0]['name'].replace('-pool', )) and (cl['Netscaler Command'] in ['add service', 'add serviceGroup'])):
                            cl['AVI Object'] = ('Merged to %s' % pool[0]['name'])
                    mergelist.append(nextpool[0]['name'])
    for plg in avi_config['PoolGroup']:
        plg['members'] = [member for member in plg['members'] if (member['pool_ref'].split('&')[1].split('=')[1] not in mergelist)]
    avi_config['Pool'] = [pools for pools in avi_config['Pool'] if (pools['name'] not in mergelist)]