def compute(self, **kwargs):
        """
        Calculate and determine if a value lies within a range.

        @keyword district: A L{District} whose argument should be 
            evaluated.
        @keyword plan: A L{Plan} whose set of districts should be 
            evaluated.
        @keyword version: Optional. The version of the plan, defaults to 
            the most recent version.
        """
        districts = None

        if 'district' in kwargs:
            districts = [kwargs['district']]

        elif 'plan' in kwargs:
            plan = kwargs['plan']
            version = kwargs['version'] if 'version' in kwargs else plan.version
            districts = plan.get_districts_at_version(version, include_geom=False)

        else:
            return

        count = 0

        if 'apply_num_members' in self.arg_dict:
            apply_num_members = int(self.arg_dict['apply_num_members'][1]) == 1
        else:
            apply_num_members = False

        for district in districts:            
            if district.district_id == 0:
                continue

            val = self.get_value('value',district)
                
            if apply_num_members and district.num_members > 1:
                val = float(val) / district.num_members
            
            minval = self.get_value('min',district)
            maxval = self.get_value('max',district)

            if val is None or minval is None or maxval is None:
                continue

            if float(val) > float(minval) and float(val) < float(maxval):
                count += 1

        self.result = { 'value': count }
dataset/ETHPy150Open PublicMapping/DistrictBuilder/django/publicmapping/redistricting/calculators.py/Range.compute/original