code: def atr(
      high,
      low,
      close,
      length=None,
      mamode=None,
      talib=None,
      drift=None,
      offset=None,
      **kwargs,
  ):
      """Indicator: Average True Range (ATR)"""
      # Validate arguments
      length = int(length) if length and length > 0 else 14
      mamode = (
          mamode.lower()
          if mamode and isinstance(mamode, str)
          else "rma"
      )
      high = verify_series(high, length)
      low = verify_series(low, length)
      close = verify_series(close, length)
      drift = get_drift(drift)
      offset = get_offset(offset)
      mode_tal = bool(talib) if isinstance(talib, bool) else True
  
      if high is None or low is None or close is None:
          return
  
      # Calculate Result
      if Imports["talib"] and mode_tal:
          from talib import ATR
  
          atr = ATR(high, low, close, length)
      else:
          tr = true_range(high=high, low=low, close=close, drift=drift)
          atr = ma(mamode, tr, length=length)
  
      percentage = kwargs.pop("percent", False)
      if percentage:
          atr *= 100 / close
  
      # Offset
      if offset != 0:
          atr = atr.shift(offset)
  
      # Handle fills
      if "fillna" in kwargs:
          atr.fillna(kwargs["fillna"], inplace=True)
      if "fill_method" in kwargs:
          atr.fillna(method=kwargs["fill_method"], inplace=True)
  
      # Name and Categorize it
      atr.name = f"ATR{mamode[0]}_{length}{'p' if percentage else ''}"
      atr.category = "volatility"
  
      return atr
  
imports: from .true_range import true_range
  from pandas_ta import Imports
  from pandas_ta.overlap import ma
  from pandas_ta.utils import get_drift, get_offset, verify_series
label_desc: Use image node_id 1 for calling a global function with example usage: atr(high, low, close, length, mamode, talib, drift, offset) and returns: atr