code: def _binomial(
      shape, seed, counts, probs, output_dtype=np.int32, name=None
  ):  # pylint: disable=unused-argument
      """Massaging dtype and nan handling of np.random.binomial."""
      rng = (
          np.random
          if seed is None
          else np.random.RandomState(seed & 0xFFFFFFFF)
      )
      invalid_count = (np.int64(counts) < 0) != (counts < 0)
      if np.any(invalid_count):
          raise ValueError(
              "int64 overflow: {} -> {}".format(
                  counts[np.where(invalid_count)],
                  np.int64(counts)[np.where(invalid_count)],
              )
          )
      probs = np.where(counts > 0, probs, 0)
      nans = np.isnan(probs)
      probs_for_np = np.where(nans, 0, probs)
      samps = rng.binomial(
          np.int64(counts), np.float64(probs_for_np), shape
      )
      return np.where(
          nans, np.nan, samps.astype(utils.numpy_dtype(output_dtype))
      )
  
imports: import numpy
  import numpy
  from tensorflow_probability.python.internal.backend.numpy import _utils
  from tensorflow_probability.python.internal.backend.numpy import ops
  from tensorflow_probability.python.internal.backend.numpy.numpy_math import softmax
label_desc: Use image node_id 3 for calling a global function with example usage: _binomial(shape, seed, counts, probs, output_dtype, name) and returns: np