def get_request_ip_resolver():
 (module, attribute) = get_cms_setting('REQUEST_IP_RESOLVER').rsplit('.', 1)
 try:
  ip_resolver_module = importlib.import_module(module)
  ip_resolver = getattr(ip_resolver_module, attribute)
 except ImportError:
  raise ImproperlyConfigured(_('Unable to find the specified CMS_REQUEST_IP_RESOLVER module: "{0}".').format(module))
 except AttributeError:
  raise ImproperlyConfigured(_('Unable to find the specified CMS_REQUEST_IP_RESOLVER function: "{0}" in module "{1}".').format(attribute, module))
 return ip_resolver

def get_request_ip_resolver ( ) : ( module , attribute ) = get_cms_setting ( 'REQUEST_IP_RESOLVER' ) . rsplit ( '.' , 1 ) try : ip_resolver_module = importlib . import_module ( module ) ip_resolver = getattr ( ip_resolver_module , attribute ) except ImportError : raise ImproperlyConfigured ( _ ( 'Unable to find the specified CMS_REQUEST_IP_RESOLVER module: "{0}".' ) . format ( module ) ) except AttributeError : raise ImproperlyConfigured ( _ ( 'Unable to find the specified CMS_REQUEST_IP_RESOLVER function: "{0}" in module "{1}".' ) . format ( attribute , module ) ) return ip_resolver
this is the recommended method for obtaining the specified cms_request_ip_resolver as it also does some basic import validation .