code: def level_to_mag(
      level: Optional[int], min_mag: float, max_mag: float
  ) -> float:
      """Map from level to magnitude."""
      if level is None:
          return round(
              np.random.rand() * (max_mag - min_mag) + min_mag, 1
          )
      else:
          return round(
              level / _MAX_LEVEL * (max_mag - min_mag) + min_mag, 1
          )
  
file_path: mmdetection/mmdet/datasets/transforms/augment_wrappers.py
imports: from typing import List, Optional, Union
  import numpy
  from mmcv.transforms import RandomChoice
  from mmcv.transforms.utils import cache_randomness
  from mmengine.config import ConfigDict
  from mmdet.registry import TRANSFORMS
label_desc: Use image node_id 2 for calling a global function with example usage: level_to_mag(level, min_mag, max_mag) and returns: round, round