code: def cg(close, length=None, offset=None, **kwargs):
      """Indicator: Center of Gravity (CG)"""
      # Validate Arguments
      length = int(length) if length and length > 0 else 10
      close = verify_series(close, length)
      offset = get_offset(offset)
  
      if close is None:
          return
  
      # Calculate Result
      coefficients = [length - i for i in range(0, length)]
      numerator = -close.rolling(length).apply(
          weights(coefficients), raw=True
      )
      cg = numerator / close.rolling(length).sum()
  
      # Offset
      if offset != 0:
          cg = cg.shift(offset)
  
      # Handle fills
      if "fillna" in kwargs:
          cg.fillna(kwargs["fillna"], inplace=True)
      if "fill_method" in kwargs:
          cg.fillna(method=kwargs["fill_method"], inplace=True)
  
      # Name and Categorize it
      cg.name = f"CG_{length}"
      cg.category = "momentum"
  
      return cg
  
label_desc: Use image node_id 1 for calling a global function with example usage: cg(close, length, offset) and returns: cg