code: def _update_color(
      use_color: bool, state: _ColorState, update: _ColorState
  ) -> tuple[_ColorState, str]:
      if not use_color or colorama is None:
          return update, ""
      color_str = ""
      if state.foreground != update.foreground:
          color_str += getattr(
              colorama.Fore, str(update.foreground.name)
          )
      if state.background != update.background:
          color_str += getattr(
              colorama.Back, str(update.background.name)
          )
      if state.intensity != update.intensity:
          color_str += (
              colorama.Style.NORMAL
          )  # pytype: disable=unsupported-operands
          color_str += getattr(
              colorama.Style, str(update.intensity.name)
          )
      return update, color_str
  
imports: from __future__ import annotations
  import abc
  from collections.abc import Sequence
  import enum
  from functools import partial
  import sys
  from typing import NamedTuple
  from jax._src import config
label_desc: Use image node_id 4 for calling a global function with example usage: _update_color(use_color, state, update) and returns: update,  color_str, update,  str