code: def decode_sequence(
      input_seq: Union[np.ndarray, SequenceType[int]],
      mapping: str,
  ) -> str:
      """Given a predefined mapping, decode the sequence of numbers to a string
  
      Args:
      ----
          input_seq: array to decode
          mapping: vocabulary (string), the encoding is given by the indexing of the character sequence
  
      Returns:
      -------
          A string, decoded from input_seq
      """
      if not isinstance(input_seq, (Sequence, np.ndarray)):
          raise TypeError("Invalid sequence type")
      if isinstance(input_seq, np.ndarray) and (
          input_seq.dtype != np.int_ or input_seq.max() >= len(mapping)
      ):
          raise AssertionError(
              "Input must be an array of int, with max less than mapping size"
          )
  
      return "".join(map(mapping.__getitem__, input_seq))
  
file_path: doctr/doctr/datasets/utils.py
imports: import string
  import unicodedata
  from collections.abc import Sequence
  from functools import partial
  from pathlib import Path
  from typing import Any, Dict, List, Optional, Tuple, TypeVar, Union
  from typing import Sequence
  import numpy
  from PIL import Image
  from doctr.io.image import get_img_shape
  from doctr.utils.geometry import convert_to_relative_coords, extract_crops, extract_rcrops
  from .vocabs import VOCABS
label_desc: Use image node_id 3 for calling a global function with example usage: decode_sequence(input_seq, mapping) and returns: str