code: def _get_subplot_rows_cols(
      num_subplots: int, rows: Optional[int], cols: Optional[int]
  ) -> Tuple[int, int]:
      """Returns the number of rows and columns to divide the subplots into
  
      Parameters
      ----------
      num_subplots : int
          The total number of subplots that need to be divided
      rows : Optional[int]
          The number of rows that the subplots need to be divided into. If none,
          this gets decided automatically based on other parameters.
      cols : Optional[int]
          The number of columns that the subplots need to be divided into. If none,
          this gets decided automatically based on other parameters.
  
      Returns
      -------
      Tuple[int, int]
          Number of rows and columns to divide the subplots into
  
      Raises
      ------
      ValueError
          When both `rows` and `cols` are provided, but are not enough to plot all
          subplots.
      """
      if rows is None and cols is not None:
          rows = ceil(num_subplots / cols)
      elif rows is not None and cols is None:
          cols = ceil(num_subplots / rows)
      elif rows is not None and cols is not None:
          available = rows * cols
          if available < num_subplots:
              raise ValueError(
                  "Not enough subplots available to plot CCF. "
                  f"You provided {rows} * {cols} = {available} subplots. "
                  f"Please provide at least {num_subplots} subplots in all."
              )
      else:
          # Decide based on data
          # If 1, then row = 1, col = 1
          # else, try 5, 4, 3, 2, and pick first one which is equally divisible
          # if None, then use 5
          if num_subplots == 1:
              cols = 1
          else:
              cols = 5
              for i in [5, 4, 3, 2]:
                  if num_subplots % i == 0:
                      cols = i
                      break
          rows = ceil(num_subplots / cols)
      return rows, cols
  
imports: from math import ceil
  from typing import Any, Dict, List, Optional, Tuple, Union
  import matplotlib
  import matplotlib.pyplot
  import numpy
  import pandas
  import plotly.express
  import plotly.graph_objects
  import plotly.io
  from plotly.colors import DEFAULT_PLOTLY_COLORS
  from plotly.subplots import make_subplots
  from scipy.fft import fft, fftfreq
  from scipy.signal import periodogram
  from statsmodels.graphics.gofplots import qqplot
  from statsmodels.tsa.seasonal import STL, seasonal_decompose
  from statsmodels.tsa.stattools import acf, ccf, pacf
  from pycaret.internal.logging import get_logger
  from pycaret.utils.generic import _resolve_dict_keys
  from pycaret.utils.time_series import TSAllowedPlotDataTypes
label_desc: Use image node_id 14 for calling a global function with example usage: _get_subplot_rows_cols(num_subplots, rows, cols) and returns: rows,  cols