code: def read_text(
      filepath: types.PathLike,
      *,
      mode: str = "rt",
      encoding: Optional[str] = None,
      lines: bool = False,
  ) -> Iterable[str]:
      """
      Read the contents of a text file at ``filepath``, either all at once
      or streaming line-by-line.
  
      Args:
          filepath: Path to file on disk from which data will be read.
          mode: Mode with which ``filepath`` is opened.
          encoding: Name of the encoding used to decode or encode the data in ``filepath``.
              Only applicable in text mode.
          lines: If False, all data is read in at once;
              otherwise, data is read in one line at a time.
  
      Yields:
          Next line of text to read in.
  
          If ``lines`` is False, wrap this output in :func:`next()` to conveniently
          access the full text.
      """
      io_utils._validate_read_mode(mode)
      with io_utils.open_sesame(
          filepath, mode=mode, encoding=encoding
      ) as f:
          if lines is False:
              yield f.read()
          else:
              for line in f:
                  yield line
  
imports: from __future__ import annotations
  from typing import Iterable, Optional, Union
  from ..None import types
  from .None import utils
label_desc: Use image node_id 1 for calling a global function with example usage: read_text(filepath) without return types