code: def create_from_tuple(
      padding: Union[tuple[int, int], Sequence[tuple[int, int]]],
      n: int,
  ) -> Sequence[tuple[int, int]]:
      """Create a padding tuple using partially specified padding tuple."""
      assert padding, "Padding must not be empty."
      if isinstance(padding[0], int):
          padding = (padding,) * n
      elif len(padding) == 1:
          padding = tuple(padding) * n
      elif len(padding) != n:
          raise TypeError(
              f"Padding {padding} must be a Tuple[int, int] or sequence of length 1"
              f" or sequence of length {n}."
          )
      padding = typing.cast(Sequence[tuple[int, int]], tuple(padding))
      return padding
  
file_path: dm-haiku/haiku/_src/pad.py
imports: from collections import abc
  from collections.abc import Sequence
  import typing
  from typing import Any, Callable, Union
  from haiku._src import utils
label_desc: Use image node_id 7 for calling a global function with example usage: create_from_tuple(padding, n) and returns: padding