code: def to_inches(value: float, units: str) -> float:
      """
      Convert value to inches
  
      Parameters
      ----------
      value : float
          Value to be converted
      units : str
          Units of value. Must be one of
          `['in', 'cm', 'mm']`.
      """
      lookup: dict[str, Callable[[float], float]] = {
          "in": lambda x: x,
          "cm": lambda x: x / 2.54,
          "mm": lambda x: x / (2.54 * 10),
      }
      try:
          return lookup[units](value)
      except KeyError as e:
          msg = f"Unknown units '{units}'"
          raise PlotnineError(msg) from e
  
imports: from __future__ import annotations
  import inspect
  import itertools
  import warnings
  from collections import defaultdict
  from collections.abc import Iterable, Sequence
  from contextlib import suppress
  from typing import TYPE_CHECKING, cast, overload
  from warnings import warn
  import numpy
  import pandas
  from pandas.core.groupby import DataFrameGroupBy
  from ..exceptions import PlotnineError, PlotnineWarning
  from ..mapping import aes
label_desc: Use image node_id 33 for calling a global function with example usage: to_inches(value, units) and returns: lookup