Applies the values of the resource dictionaries to network resource pools,
    creating the resource pools if required
    (vim.DVSNetworkResourcePoolConfigSpec)

def _apply_dvs_network_resource_pools(network_resource_pools, resource_dicts):
    '''
    Applies the values of the resource dictionaries to network resource pools,
    creating the resource pools if required
    (vim.DVSNetworkResourcePoolConfigSpec)
    '''
    for res_dict in resource_dicts:
        ress = [r for r in network_resource_pools if r.key == res_dict['key']]
        if ress:
            res = ress[0]
        else:
            res = vim.DVSNetworkResourcePoolConfigSpec()
            res.key = res_dict['key']
            res.allocationInfo = \
                    vim.DVSNetworkResourcePoolAllocationInfo()
            network_resource_pools.append(res)
        if res_dict.get('limit'):
            res.allocationInfo.limit = res_dict['limit']
        if res_dict.get('num_shares') and res_dict.get('share_level'):
            if not res.allocationInfo.shares:
                res.allocationInfo.shares = vim.SharesInfo()
            res.allocationInfo.shares.shares = res_dict['num_shares']
            res.allocationInfo.shares.level = \
                    vim.SharesLevel(res_dict['share_level'])