# Path: crabpy/client.py
# def crab_request(client, action, *args):
#     """
#     Utility function that helps making requests to the CRAB service.
# 
#     :param client: A :class:`suds.client.Client` for the CRAB service.
#     :param string action: Which method to call, eg. `ListGewesten`
#     :returns: Result of the SOAP call.
# 
#     .. versionadded:: 0.3.0
#     """
#     log.debug("Calling %s on CRAB service.", action)
#     return getattr(client.service, action)(*args)
# 
# Path: crabpy/gateway/exception.py
# class GatewayResourceNotFoundException(GatewayException):
#     """
#     An exception that signifies that no results where found.
#     """
#     def __init__(self):
#         GatewayException.__init__(self, 'This resource was not found.')
# 
# Path: crabpy/gateway/exception.py
# class GatewayRuntimeException(GatewayException):
#     """
#     An exception that signifies a soap request went wrong.
# 
#     """
# 
#     soapfault = None
#     """
#     The soapfault that was generated by the service.
#     """
# 
#     def __init__(self, message, soapfault):
#         GatewayException.__init__(self, message)
#         self.soapfault = soapfault


import json
import logging
import math
import os
from dogpile.cache import make_region
from suds import WebFault
from crabpy.client import crab_request
from crabpy.gateway.exception import GatewayResourceNotFoundException
from crabpy.gateway.exception import GatewayRuntimeException
                    v
                )for k, v in tmp.items()
            ]
        if self.caches['permanent'].is_configured:
            key = 'ListGewesten#%s' % sort
            gewesten = self.caches['permanent'].get_or_create(key, creator)
        else:
            gewesten = creator()
        for g in gewesten:
            g.set_gateway(self)
        return gewesten

    def get_gewest_by_id(self, id):
        """
        Get a `gewest` by id.

        :param integer id: The id of a `gewest`.
        :rtype: A :class:`Gewest`.
        """
        def creator():
            nl = crab_gateway_request(
                self.client, 'GetGewestByGewestIdAndTaalCode', id, 'nl'
            )
            fr = crab_gateway_request(
                self.client, 'GetGewestByGewestIdAndTaalCode', id, 'fr'
            )
            de = crab_gateway_request(
                self.client, 'GetGewestByGewestIdAndTaalCode', id, 'de'
            )
            if nl == None:

# Path: crabpy/client.py
# def crab_request(client, action, *args):
#     """
#     Utility function that helps making requests to the CRAB service.
# 
#     :param client: A :class:`suds.client.Client` for the CRAB service.
#     :param string action: Which method to call, eg. `ListGewesten`
#     :returns: Result of the SOAP call.
# 
#     .. versionadded:: 0.3.0
#     """
#     log.debug("Calling %s on CRAB service.", action)
#     return getattr(client.service, action)(*args)
# 
# Path: crabpy/gateway/exception.py
# class GatewayResourceNotFoundException(GatewayException):
#     """
#     An exception that signifies that no results where found.
#     """
#     def __init__(self):
#         GatewayException.__init__(self, 'This resource was not found.')
# 
# Path: crabpy/gateway/exception.py
# class GatewayRuntimeException(GatewayException):
#     """
#     An exception that signifies a soap request went wrong.
# 
#     """
# 
#     soapfault = None
#     """
#     The soapfault that was generated by the service.
#     """
# 
#     def __init__(self, message, soapfault):
#         GatewayException.__init__(self, message)
#         self.soapfault = soapfault


# Path: crabpy/gateway/crab.py
import json
import logging
import math
import os
from dogpile.cache import make_region
from suds import WebFault
from crabpy.client import crab_request
from crabpy.gateway.exception import GatewayResourceNotFoundException
from crabpy.gateway.exception import GatewayRuntimeException

                    v
                )for k, v in tmp.items()
            ]
        if self.caches['permanent'].is_configured:
            key = 'ListGewesten#%s' % sort
            gewesten = self.caches['permanent'].get_or_create(key, creator)
        else:
            gewesten = creator()
        for g in gewesten:
            g.set_gateway(self)
        return gewesten

    def get_gewest_by_id(self, id):
        """
        Get a `gewest` by id.

        :param integer id: The id of a `gewest`.
        :rtype: A :class:`Gewest`.
        """
        def creator():
            nl = crab_gateway_request(
                self.client, 'GetGewestByGewestIdAndTaalCode', id, 'nl'
            )
            fr = crab_gateway_request(
                self.client, 'GetGewestByGewestIdAndTaalCode', id, 'fr'
            )
            de = crab_gateway_request(
                self.client, 'GetGewestByGewestIdAndTaalCode', id, 'de'
            )
            if nl == None:

                raise GatewayResourceNotFoundException()