code: def _apply_vocab(
      rows: Sequence[Any], vocab: dict[str, int], multioutput: bool
  ):
      """Given a vocabulary, converts a multioutput input to a indicator output."""
      result = np.empty((len(rows), len(vocab)), dtype=np.bool_)
      result.fill(False)
      if multioutput:
          for i, row in enumerate(rows):
              for elem in row:
                  result[i][vocab[elem]] = True
      else:
          for i, elem in enumerate(rows):
              result[i][vocab[elem]] = True
      return result
  
imports: from collections.abc import Iterable, Sequence
  import dataclasses
  import enum
  import itertools
  from typing import Any
  import numpy
  from numpy import typing
  from tensorflow_model_analysis.experimental.lazytf import api
label_desc: Use image node_id 8 for calling a global function with example usage: _apply_vocab(rows, vocab, multioutput) and returns: result