code: def configuration_check(config):
      log_level = config.get('daemon', 'loglevel')
      num_level = getattr(logging, log_level.upper(), None)
      pidfile = config.get('daemon', 'pidfile')
      if not os.path.isdir(os.path.dirname(pidfile)):
          raise ValueError("{d} doesn't exit".format(d=os.path.dirname(pidfile)))
      if not isinstance(num_level, int):
          raise ValueError('Invalid log level: {}'.format(log_level))
      for _file in 'log_file', 'stderr_file':
          if config.has_option('daemon', _file):
              try:
                  touch(config.get('daemon', _file))
              except OSError as exc:
                  raise ValueError(exc)
      for option, getter in DAEMON_OPTIONS_TYPE.items():
          try:
              getattr(config, getter)('daemon', option)
          except configparser.NoOptionError as error:
              if option not in DAEMON_OPTIONAL_OPTIONS:
                  raise ValueError(error)
          except configparser.Error as error:
              raise ValueError(error)
          except ValueError as exc:
              msg = ("invalid data for '{opt}' option in daemon section: {err}"
                     .format(opt=option, err=exc))
              raise ValueError(msg)
      service_configuration_check(config)