code: def test_focus(
      model: Optional[ModelInterface],
      mosaic_data: Dict[str, Union[np.ndarray, list]],
      a_batch: Optional[np.ndarray],
      params: dict,
      expected: Optional[dict],
  ):
      x_batch, y_batch, custom_batch = (
          mosaic_data["x_batch"],
          mosaic_data["y_batch"],
          mosaic_data["custom_batch"],
      )
      init_params = params.get("init", {})
      call_params = params.get("call", {})
  
      metric = Focus(**init_params)
  
      if expected and "exception" in expected:
          with pytest.raises(expected["exception"]):
              metric(
                  model=model,
                  x_batch=x_batch,
                  y_batch=y_batch,
                  a_batch=a_batch,
                  custom_batch=custom_batch,
                  **call_params,
              )
          return
  
      custom_batch_len = len(custom_batch)
      while len(custom_batch) > 0:
          if x_batch is not None:
              x_batch_mini, x_batch = x_batch[:10], x_batch[10:]
          else:
              x_batch_mini = None
          if y_batch is not None:
              y_batch_mini, y_batch = y_batch[:10], y_batch[10:]
          else:
              y_batch_mini = None
          if a_batch is not None:
              a_batch_mini, a_batch = a_batch[:10], a_batch[10:]
          else:
              a_batch_mini = None
  
          custom_batch_mini, custom_batch = (
              custom_batch[:10],
              custom_batch[10:],
          )
  
          scores = metric(
              model=model,
              x_batch=x_batch_mini,
              y_batch=y_batch_mini,
              a_batch=a_batch_mini,
              custom_batch=custom_batch_mini,
              **call_params,
          )
  
      assert len(scores) == len(custom_batch_mini), "Test failed."
      assert all([0 <= score <= 1 for score in scores]), "Test failed."
      if expected and "value" in expected:
          assert all(
              (score == expected["value"]) for score in scores
          ), "Test failed."
  
imports: from typing import Union, Optional, Dict
  import pytest
  from pytest_lazyfixture import lazy_fixture
  import numpy
  import torch
  import pickle
  from quantus.functions.explanation_func import explain
  from quantus.functions.mosaic_func import mosaic_creation
  from quantus.helpers.model.model_interface import ModelInterface
  from quantus.helpers.model.models import LeNetAdaptivePooling
  from quantus.metrics.localisation import AttributionLocalisation, AUC, Focus, PointingGame, RelevanceMassAccuracy, RelevanceRankAccuracy, TopKIntersection
label_desc: Use image node_id 32 for calling a global function with example usage: test_focus(model, mosaic_data, a_batch, params, expected) without return types