code: def get_required_setting(setting, value_re, invalid_msg):
      
      try:
          value = getattr(settings, setting)
      except AttributeError:
          raise AnalyticalException("%s setting: not found" % setting)
      if not value:
          raise AnalyticalException("%s setting is not set" % setting)
      value = str(value)
      if not value_re.search(value):
          raise AnalyticalException("%s setting: %s: '%s'"
                                    % (setting, invalid_msg, value))
      return value
docs: Return a constant from ``django.conf.settings``.  The `setting`
      argument is the constant name, the `value_re` argument is a regular
      expression used to validate the setting value and the `invalid_msg`
      argument is used as exception message if the value is not valid.