def _resolve_component(
        component: nn.Module | None,
        component_type: type,
        default_callable: Callable,
    ) -> nn.Module | None:
        """Resolve and validate the subcomponent configuration.

        This method resolves the configuration for various subcomponents like
        pre-processor, post-processor, evaluator and visualizer. It validates
        the configuration and returns the configured component. If the component
        is a boolean, it uses the default callable to create the component. If
        the component is already an instance of the component type, it returns
        the component as is.

        Args:
            component (object): Component configuration
            component_type (Type): Type of the component
            default_callable (Callable): Callable to create default component

        Returns:
            Component | None: Configured component

        Raises:
            TypeError: If component is invalid type
        """
        if isinstance(component, component_type):
            return component
        if isinstance(component, bool):
            return default_callable() if component else None
        msg = f"Passed object should be {component_type} or bool, got: {type(component)}"
        raise TypeError(msg)
Resolve and validate the subcomponent configuration.

        This method resolves the configuration for various subcomponents like
        pre-processor, post-processor, evaluator and visualizer. It validates
        the configuration and returns the configured component. If the component
        is a boolean, it uses the default callable to create the component. If
        the component is already an instance of the component type, it returns
        the component as is.

        Args:
            component (object): Component configuration
            component_type (Type): Type of the component
            default_callable (Callable): Callable to create default component

        Returns:
            Component | None: Configured component

        Raises:
            TypeError: If component is invalid type
        
src/anomalib/models/components/base/anomalib_module.py