def compute(self, **kwargs):
        """
        Compute the number of districts in a plan.

        @keyword plan: A L{Plan} whose set of districts should be verified 
            against the target.
        @keyword version: Optional. The version of the plan, defaults to
            the most recent version.
        @keyword target: The target number of districts in the plan.
        """
        if not 'plan' in kwargs or not 'target' in self.arg_dict:
            return

        plan = kwargs['plan']
        version = kwargs['version'] if 'version' in kwargs else plan.version
        districts = plan.get_districts_at_version(version, include_geom=False)
        # ALL PLANS include 1 district named "Unassigned", which cannot be
        # removed. Therefore the actual target to be validated is one less
        # than the number of districts.
        target = int(self.get_value('target'))

        self.result = { 'value': (len(districts)-1) == target }
dataset/ETHPy150Open PublicMapping/DistrictBuilder/django/publicmapping/redistricting/calculators.py/CountDistricts.compute/original