code: def _seaborn_viz_plot_autocorrelation(
      timeseries, plot_type="acf", n_lags=40, fft=False, **kwargs
  ):
      """Create timeseries autocorrelation visualization.
  
      Args:
          timeseries: Series object containing datetime index
          plot_type: Choose between 'acf' or 'pacf. Defaults to "pacf".
          n_lags: Number of lags to return autocorrelation for. Defaults to 40.
          fft (bool): If True, computes ACF via FFT.
          **kwargs: Keyword arguments for plot_acf or plot_pacf.
  
      Raises:
          ValueError: Invalid `plot_type`.
  
      Returns:
          The visualization
      """
      fig, ax = plt.subplots(
          figsize=(
              get_option("display.matplotlib.fig_width"),
              get_option("display.matplotlib.fig_height"),
          )
      )
      if plot_type == "acf":
          fig = _compat["statsmodels.api"].graphics.tsa.plot_acf(  # type: ignore
              timeseries, ax=ax, lags=n_lags, fft=fft, **kwargs
          )
      elif plot_type == "pacf":
          fig = _compat["statsmodels.api"].graphics.tsa.plot_pacf(  # type: ignore
              timeseries, ax=ax, lags=n_lags, **kwargs
          )
      else:
          raise ValueError("Unsupported input data type")
      plt.xlabel("Lags")
      plt.ylabel(plot_type)
      plt.close()
      return fig
  
imports: import warnings
  from typing import Optional
  import matplotlib.pyplot
  import seaborn
  import pandas
  import numpy
  import plotly.graph_objs
  from plotly.subplots import make_subplots
  from plotly.offline import init_notebook_mode, iplot
  from data_describe.config._config import get_option
  from data_describe.backends import _get_viz_backend, _get_compute_backend
  from data_describe.compat import _is_dataframe, _compat, _requires, _in_notebook
label_desc: Use image node_id 15 for calling a global function with example usage: _seaborn_viz_plot_autocorrelation(timeseries, plot_type, n_lags, fft) and returns: fig