code: def replicate(
      element: Union[T, Sequence[T]],
      num_times: int,
      name: str,
  ) -> tuple[T, ...]:
      """Replicates entry in `element` `num_times` if needed."""
      if isinstance(element, (str, bytes)) or not isinstance(
          element, collections.abc.Sequence
      ):
          return (element,) * num_times
      elif len(element) == 1:
          return tuple(element * num_times)
      elif len(element) == num_times:
          return tuple(element)
      raise TypeError(
          f"{name} must be a scalar or sequence of length 1 or sequence of "
          f"length {num_times}."
      )
  
file_path: dm-haiku/haiku/_src/utils.py
imports: import collections.abc
  from collections.abc import Sequence
  import decimal
  import inspect
  import pprint
  import re
  from typing import Any, TypeVar, Union
  import jax
label_desc: Use image node_id 5 for calling a global function with example usage: replicate(element, num_times, name) and returns: unknown, tuple, tuple