code: def get_center_of_mass(
      comass: float | None,
      span: float | None,
      halflife: float | None,
      alpha: float | None,
  ) -> float:
      valid_count = common.count_not_none(comass, span, halflife, alpha)
      if valid_count > 1:
          raise ValueError(
              "comass, span, halflife, and alpha are mutually exclusive"
          )
  
      # Convert to center of mass; domain checks ensure 0 < alpha <= 1
      if comass is not None:
          if comass < 0:
              raise ValueError("comass must satisfy: comass >= 0")
      elif span is not None:
          if span < 1:
              raise ValueError("span must satisfy: span >= 1")
          comass = (span - 1) / 2
      elif halflife is not None:
          if halflife <= 0:
              raise ValueError("halflife must satisfy: halflife > 0")
          decay = 1 - np.exp(np.log(0.5) / halflife)
          comass = 1 / decay - 1
      elif alpha is not None:
          if alpha <= 0 or alpha > 1:
              raise ValueError("alpha must satisfy: 0 < alpha <= 1")
          comass = (1 - alpha) / alpha
      else:
          raise ValueError(
              "Must pass one of comass, span, halflife, or alpha"
          )
  
      return float(comass)
  
imports: from __future__ import annotations
  import datetime
  from functools import partial
  from textwrap import dedent
  from typing import TYPE_CHECKING
  import numpy
  from pandas._libs.tslibs import Timedelta
  import pandas._libs.window.aggregations
  from pandas.util._decorators import doc
  from pandas.core.dtypes.common import is_datetime64_dtype, is_numeric_dtype
  from pandas.core.dtypes.dtypes import DatetimeTZDtype
  from pandas.core.dtypes.generic import ABCSeries
  from pandas.core.dtypes.missing import isna
  from pandas.core import common
  from pandas.core.arrays.datetimelike import dtype_to_unit
  from pandas.core.indexers.objects import BaseIndexer, ExponentialMovingWindowIndexer, GroupbyIndexer
  from pandas.core.util.numba_ import get_jit_arguments, maybe_use_numba
  from pandas.core.window.common import zsqrt
  from pandas.core.window.doc import _shared_docs, create_section_header, kwargs_numeric_only, numba_notes, template_header, template_returns, template_see_also, window_agg_numba_parameters
  from pandas.core.window.numba_ import generate_numba_ewm_func, generate_numba_ewm_table_func
  from pandas.core.window.online import EWMMeanState, generate_online_numba_ewma_func
  from pandas.core.window.rolling import BaseWindow, BaseWindowGroupby
label_desc: Use image node_id 1 for calling a global function with example usage: get_center_of_mass(comass, span, halflife, alpha) and returns: float