<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _validate_config(self):
 """ Handle and check configuration. """

        groups = dict(
            job=defaultdict(Bunch),
            httpd=defaultdict(Bunch),
        )

        for key, val in config.torque.items():
            # Auto-convert numbers and bools
            if val.isdigit():
                config.torque[key] = val = int(val)
            elif val.lower() in (matching.TRUE | matching.FALSE):
                val = matching.truth(str(val), key)

            # Assemble grouped parameters
            stem = key.split('.', 1)[0]
            if key == "httpd.active":
                groups[stem]["active"] = val
            elif stem in groups:
                try:
                    stem, name, param = key.split('.', 2)
                except (TypeError, ValueError):
                    self.fatal("Bad %s configuration key %r (expecting %s.NAME.PARAM)" % (stem, key, stem))
                else:
                    groups[stem][name][param] = val

        for key, val in groups.iteritems():
            setattr(self, key.replace("job", "jobs"), Bunch(val))

        # Validate httpd config
        if self.httpd.active:
            if self.httpd.waitress.url_scheme not in ("http", "https"):
                self.fatal("HTTP URL scheme must be either 'http' or 'https'")
            if not isinstance(self.httpd.waitress.port, int) or not(1024 <= self.httpd.waitress.port < 65536):
                self.fatal("HTTP port must be a 16 bit number >= 1024")

        # Validate jobs
        for name, params in self.jobs.items():
            for key in ("handler", "schedule"):
                if key not in params:
                    self.fatal("Job '%s' is missing the required 'job.%s.%s' parameter" % (name, name, key))

            bool_param = lambda k, default, p=params: matching.truth(p.get(k, default), "job.%s.%s" % (name, k))

            params.job_name = name
            params.dry_run = bool_param("dry_run", False) or self.options.dry_run
            params.active = bool_param("active", True)
            params.schedule = self._parse_schedule(params.schedule)

            if params.active:
                try:
                    params.handler = pymagic.import_name(params.handler)
                except ImportError as exc:
                    self.fatal("Bad handler name '%s' for job '%s':\n    %s" % (params.handler, name, exc))