code: def _invoke_spatial_distortion_index(
      preds, target, ms, pan, pan_lr, norm_order, window_size
  ):
      ms = target["ms"] if "ms" in target else ms
      pan = target["pan"] if "pan" in target else pan
      pan_lr = target["pan_lr"] if "pan_lr" in target else pan_lr
      return spatial_distortion_index(
          preds, ms, pan, pan_lr, norm_order, window_size
      )
  
imports: from functools import partial
  from typing import Dict, List, NamedTuple
  import numpy
  import pytest
  import torch
  from scipy.ndimage import uniform_filter
  from skimage.transform import resize
  from torch import Tensor
  from torchmetrics.functional.image.d_s import spatial_distortion_index
  from torchmetrics.functional.image.uqi import universal_image_quality_index
  from torchmetrics.image.d_s import SpatialDistortionIndex
  from unittests import BATCH_SIZE, NUM_BATCHES
  from unittests.helpers import seed_all
  from unittests.helpers.testers import MetricTester
label_desc: Use image node_id 3 for calling a global function with example usage: _invoke_spatial_distortion_index(preds, target, ms, pan, pan_lr, norm_order, window_size) and returns: spatial_distortion_index