code: def lag_corr(
      data: pd.Series, lags: Optional[Tuple[int, ...]] = tuple()
  ) -> Tuple[pd.DataFrame, pd.Series]:
      """Creates a DataFrame with the level data plus shifts as per the ``lags`` parameter.
  
      Args:
          data (pd.Series): Timeseries data.
          lags (Optional[Tuple[int, ...]]): Lags to shift the data on. If not supplied attempts to
              find appropriate defaults based on the frequency.
  
      Returns:
          pd.DataFrame, pd.DataFrame: DataFrame with shifted data, DataFrame with correlation between
          lagged and level
      """
      freq = data.index.inferred_freq
      freq = freq[0] if freq else ""
      if not lags:
          max_lag = len(data)
          lags_dic = {
              "A": (1, 2, 3, 4, 5, 6, 10, 15),
              "Q": (1, 2, 3, 4, 5, 6, 8, 16),
              "M": (1, 2, 3, 4, 6, 9, 12, 24),
              "W": (1, 2, 3, 4, 12, 24, 36, 48),
              "D": (1, 2, 3, 4, 5, 6, 7, 14, 30, 90, 180, 365),
              "B": (1, 2, 3, 4, 5, 10, 20, 40, 60, 120, 180, 240),
              "H": tuple(range(1, 25)),
          }
          lags = lags_dic.get(freq, (1, 2, 3)) or tuple()
          lags = tuple(lag for lag in lags if lag <= max_lag)
      df_lags = pd.concat(
          [data.rename("original")]
          + [
              data.shift(lag).rename(f"lag {lag}{freq}") for lag in lags
          ],
          axis=1,
      )
      return df_lags, df_lags.corr()["original"]
  
file_path: tslumen/tslumen/profile/correlation.py
imports: from typing import Optional, Tuple
  import numpy
  import pandas
  from statsmodels.tsa import stattools
  from tslumen.profile.base import ProfilingFunction
label_desc: Use image node_id 10 for calling a global function with example usage: lag_corr(data, lags) and returns: df_lags,  df_lags