code: def optimal_leverage(
      close: Series,
      benchmark_rate: float = 0.0,
      period: Tuple[float, int] = RATE["TRADING_DAYS_PER_YEAR"],
      log: bool = False,
      capital: float = 1.0,
      **kwargs,
  ) -> float:
      """Optimal Leverage of a series. NOTE: Incomplete. Do NOT use.
  
      Args:
          close (pd.Series): Series of 'close's
          benchmark_rate (float): Benchmark Rate to use. Default: 0.0
          period (int, float): Period to use to calculate Mean Annual Return and
              Annual Standard Deviation.
              Default: None or the default sharpe_ratio.period()
          log (bool): If True, calculates log_return. Otherwise it returns
              percent_return. Default: False
  
      >>> result = ta.optimal_leverage(close, benchmark_rate=0.0, log=False)
      """
      close = verify_series(close)
  
      use_cagr = kwargs.pop("use_cagr", False)
      returns = (
          percent_return(close=close)
          if not log
          else log_return(close=close)
      )
      # sharpe = sharpe_ratio(close, benchmark_rate=benchmark_rate, log=log, use_cagr=use_cagr, period=period)
  
      period_mu = period * returns.mean()
      period_std = npSqrt(period) * returns.std()
  
      mean_excess_return = period_mu - benchmark_rate
      # sharpe = mean_excess_return / period_std
      opt_leverage = (period_std**-2) * mean_excess_return
  
      amount = int(capital * opt_leverage)
      return amount
  
imports: from typing import Tuple
  from numpy import log
  from numpy import nan
  from numpy import sqrt
  from pandas import Series, Timedelta
  from ._core import verify_series
  from ._time import total_time
  from ._math import linear_regression, log_geometric_mean
  from pandas_ta import RATE
  from pandas_ta.performance import drawdown, log_return, percent_return
label_desc: Use image node_id 7 for calling a global function with example usage: optimal_leverage(close, benchmark_rate, period, log, capital) and returns: amount