def _dispatch(self, stmt, stage, *args):
        """Construct and call an assembly function.

        This function constructs the name of the assembly function based on
        the type of statement, the corresponding policy and the stage
        of assembly. It then calls that function to perform the assembly
        task."""
        policy = self.processed_policies[stmt.uuid]
        class_name = stmt.__class__.__name__.lower()
        # We map remove modifications to their positive counterparts
        if isinstance(stmt, ist.RemoveModification):
            class_name = ist.modclass_to_modtype[stmt.__class__]
        # We handle any kind of activity regulation in regulateactivity
        if isinstance(stmt, ist.RegulateActivity):
            class_name = 'regulateactivity'
        func_name = '%s_%s_%s' % (class_name, stage, policy.name)
        func = globals().get(func_name)
        if func is None:
            # The specific policy is not implemented for the
            # given statement type.
            # We try to apply a default policy next.
            func_name = '%s_%s_default' % (class_name, stage)
            func = globals().get(func_name)
            if func is None:
                # The given statement type doesn't have a default
                # policy.
                raise UnknownPolicyError('%s function %s not defined' %
                                         (stage, func_name))
        return func(stmt, *args)
Construct and call an assembly function.

        This function constructs the name of the assembly function based on
        the type of statement, the corresponding policy and the stage
        of assembly. It then calls that function to perform the assembly
        task.