'Returns allocation pools represented as list of IPRanges'

def _prepare_allocation_pools(self, allocation_pools, cidr, gateway_ip):

    if (not validators.is_attr_set(allocation_pools)):
        return self.generate_pools(cidr, gateway_ip)
    ip_range_pools = self.pools_to_ip_range(allocation_pools)
    self.validate_allocation_pools(ip_range_pools, cidr)
    if gateway_ip:
        self.validate_gw_out_of_pools(gateway_ip, ip_range_pools)
    return ip_range_pools
