def compute(self, **kwargs):
        """
        Evaluate a L{Plan} to determine if it is type-compatible. A L{Plan}
        will be type-compatible if the type provided is in all L{District}s
        of the plan.

        @keyword plan: The L{Plan} to compare against the community
            map.
        @keyword community_map_id: The ID of the community map.
        @keyword plan_version: Optional, The version of the plan.
            Defaults to the latest version of the plan.
        @keyword community_version: Optional. The version of the community 
            map.  Defaults to the latest version of the community map.
        @keyword type: The community type to check for compatibility.
        """
        if not 'plan' in kwargs:
            return

        plan = kwargs['plan']

        if 'plan_version' in kwargs:
            pversion = kwargs['plan_version']
        else:
            pversion = plan.version

        if 'community_version' in kwargs:
            cversion = kwargs['community_version']
        else:
            cversion = None

        districts = plan.get_districts_at_version(pversion, include_geom=True)

        if not 'community_map_id' in kwargs:
            self.result = { 'value': 'n/a' }
            return

        ctype = kwargs['type']
        if not ctype.startswith('type='):
            ctype = 'type=' + ctype

        community_id = kwargs['community_map_id']
        alltypes = None
        for district in districts:
            if district.is_unassigned:
                continue

            tmpset = district.get_community_type_union(community_id, version=cversion)

            if alltypes is None:
                alltypes = tmpset
            else:
                alltypes = alltypes & tmpset

        # simplify all the matching tags to strings, not Tag objects
        alltypes = map(lambda x:str(x.name), alltypes)
        self.result = { 'value': (ctype in alltypes) }
dataset/ETHPy150Open PublicMapping/DistrictBuilder/django/publicmapping/redistricting/calculators.py/CommunityTypeCompatible.compute/original