def METHOD_NAME(
    executor: Union[Executor, Callable[[QPROGRAM], MeasurementResult]],
    *,
    inverse_confusion_matrix: npt.NDArray[np.float64],
) -> Union[Executor, Callable[[QPROGRAM], MeasurementResult]]:
    """Returns a modified version of the input 'executor' which is
    error-mitigated with readout confusion inversion (RCI).
    The type of the output executor will be equal to the type of
    the input executor: an :class:`.Executor` object or a Python callable.
    Args:
        executor: A Mitiq executor that executes a circuit and returns the
            unmitigated ``MeasurementResult``.
        inverse_confusion_matrix: The inverse confusion matrix to apply to the
            probability vector estimated with noisy measurement results.
    Returns:
        The error-mitigated version of the input executor.
    """
    # We always mitigate an Executor object but, to preserve the input type,
    # we eventually return a callable if the input executor is a callable.
    if not isinstance(executor, Executor):
        executor_obj = Executor(executor)
    else:
        executor_obj = executor
    def post_run(
        self: Executor,
        results: Sequence[MeasurementResult],
    ) -> Sequence[MeasurementResult]:
        return [
            mitigate_measurements(res, inverse_confusion_matrix)
            for res in results
        ]
    setattr(executor_obj, "_post_run", MethodType(post_run, executor_obj))
    if isinstance(executor, Executor):
        new_executor = executor_obj
    elif not executor_obj.can_batch:
        @wraps(executor)
        def new_executor(circuit: QPROGRAM) -> MeasurementResult:
            result = cast(MeasurementResult, executor_obj.run([circuit])[0])
            return result
    elif executor_obj.can_batch:
        @wraps(executor)
        def new_executor(
            circuits: List[QPROGRAM],
        ) -> Sequence[MeasurementResult]:
            results = executor_obj.run(circuits)
            return cast(Sequence[MeasurementResult], results)
    return new_executor