code: def interpolate_severity(img, cifar, imagenet, severity):
      torchdrift.utils.check(
          severity >= 1 and severity <= 5,
          "severity needs to be between 1 and 5",
      )
      length = (img.size(-1) * img.size(-2)) ** 0.5
      alpha = max(min((length - 32) / (224 - 32), 1), 0)
      res = (1 - alpha) * cifar[severity - 1] + alpha * imagenet[
          severity - 1
      ]
      if isinstance(cifar[0], int):
          res = int(res)
      return res
  
file_path: TorchDrift/torchdrift/data/functional/corruption_functions.py
imports: from torch import Tensor
  import torch
  import math
  import torchdrift.utils
label_desc: Use image node_id 2 for calling a global function with example usage: interpolate_severity(img, cifar, imagenet, severity) and returns: res