code: def _make_mask_by_value(truths, guesses, missing_value) -> Floats2d:
      xp = get_array_module(guesses)
      mask = xp.ones(guesses.shape, dtype="f")
  
      if missing_value is not None:
          if truths.ndim == 1:
              mask[truths == missing_value] = 0.0
          else:
              # In 2D truths, labels are encoded as one-hot vectors, so we can get
              # the label indices using argmax.
              labels = xp.argmax(truths, axis=-1)
              mask[labels == missing_value] = 0.0
  
      return mask
  
imports: from abc import abstractmethod
  from typing import Any, Dict, Generic, List, Optional, Sequence, Tuple, TypeVar, Union, cast
  from .config import registry
  from .types import Floats2d, Ints1d
  from .util import get_array_module, to_categorical
label_desc: Use image node_id 10 for calling a global function with example usage: _make_mask_by_value(truths, guesses, missing_value) and returns: mask