code: def one_hot_multidiscrete(x, depths=List[int]):
      # Handle torch arrays properly.
      if torch and isinstance(x, torch.Tensor):
          x = x.numpy()
  
      shape = x.shape
      return np.concatenate(
          [
              one_hot(
                  x[i] if len(shape) == 1 else x[:, i], depth=n
              ).astype(np.float32)
              for i, n in enumerate(depths)
          ],
          axis=-1,
      )
  
imports: from collections import OrderedDict
  from gymnasium.spaces import Discrete, MultiDiscrete
  import numpy
  import tree
  from types import MappingProxyType
  from typing import List, Optional
  from ray.rllib.utils.annotations import PublicAPI
  from ray.rllib.utils.deprecation import Deprecated
  from ray.rllib.utils.framework import try_import_tf, try_import_torch
  from ray.rllib.utils.typing import SpaceStruct, TensorType, TensorStructType, Union
label_desc: Use image node_id 11 for calling a global function with example usage: one_hot_multidiscrete(x, depths) and returns: np