def compute(self, **kwargs):
        """
        Calculate splits between a plan and a target layer.

        @keyword plan: A L{Plan} whose districts will be analyzed for 
            splits.
        @keyword version: Optional. The version of the plan, defaults to 
            the most recent version.
        @keyword boundary_id: The layer type and ID to compare for splits.
        @keyword inverse: A flag to indicate if the splits should be 
            compared forward or backward.
        @keyword only_total: A flag to indicate if only the total number
            of splits should be returned.
        """
        if not 'plan' in kwargs:
            return

        plan = kwargs['plan']

        # Set the version
        version = self.get_value('version')
        if version is None:
            version = plan.version

        # Use the argument to find "bottom" map
        target = self.get_value('boundary_id')

        # Check if we should invert the order or the layers
        inverse = self.get_value('inverse') == 1

        # Check if we only need to return the total in the html
        only_total = (self.get_value('only_total') == 1)
        splits = plan.compute_splits(target, version=version, inverse=inverse)
        
        self.result = {
            'value': len(splits['splits']) if only_total else splits,
            'only_total': only_total
        }
dataset/ETHPy150Open PublicMapping/DistrictBuilder/django/publicmapping/redistricting/calculators.py/SplitCounter.compute/original