code: def _make_lattice_upper_bounds(
      jax_numpy_dtype_promotion: str,
  ) -> dict[JAXType, set[JAXType]]:
      lattice = _type_promotion_lattice(jax_numpy_dtype_promotion)
      upper_bounds = {node: {node} for node in lattice}
      for n in lattice:
          while True:
              new_upper_bounds = set().union(
                  *(lattice[b] for b in upper_bounds[n])
              )
              if n in new_upper_bounds:
                  raise ValueError(
                      f"cycle detected in type promotion lattice for node {n}"
                  )
              if new_upper_bounds.issubset(upper_bounds[n]):
                  break
              upper_bounds[n] |= new_upper_bounds
      return upper_bounds
  
imports: from __future__ import annotations
  import abc
  import builtins
  import functools
  from typing import cast, overload, Any, Literal, Union
  import warnings
  import ml_dtypes
  import numpy
  from jax._src import config
  from jax._src.typing import DType, DTypeLike
  from jax._src.util import set_module
  from jax._src import traceback_util
label_desc: Use image node_id 17 for calling a global function with example usage: _make_lattice_upper_bounds(jax_numpy_dtype_promotion) and returns: upper_bounds