code: def infer_freq(df, time_col=TIME_COL, window_size=20):
      """Infers frequency of the timestamps provided in the ``time_col`` of ``df``.
  
      Notes
      -----
      If the timeseries does not have any missing values the
      ``pandas.infer_freq`` can correctly infer any valid frequency with 20 datapoints.
      Valid frequencies are listed here:
      https://pandas.pydata.org/pandas-docs/stable/user_guide/timeseries.html#offset-aliases.
  
      Parameters
      ----------
      df : `pandas.DataFrame`
          Dataframe with column ``time_col``
      time_col: `str` or None, default TIME_COL
          Time column name
      window_size: `int` or None, default 20
          Window size to subset ``df`` at each iteration
  
      Returns
      -------
      freq : `str`
          Inferred frequency of the timestamps provided in the ``time_col`` of ``df``.
      """
      df = df.copy()
      df = df[df[time_col].notna()]
      df[time_col] = pd.to_datetime(df[time_col])
      freq = pd.infer_freq(df[time_col])
      if freq is None:
          start_index = 0
          end_index = start_index + window_size
          while end_index <= df.shape[0]:
              df_temp = df.iloc[start_index:end_index]
              freq = pd.infer_freq(df_temp[time_col])
              if freq is not None:
                  break
              start_index = end_index
              end_index = start_index + window_size
  
      return freq
  
file_path: greykite/greykite/common/time_properties.py
imports: import datetime
  import warnings
  from typing import Dict
  from typing import List
  from typing import Optional
  from typing import Union
  import numpy
  import pandas
  from greykite.common.constants import TIME_COL
  from greykite.common.constants import VALUE_COL
  from greykite.common.features.adjust_anomalous_data import adjust_anomalous_data
  from greykite.common.logging import LoggingLevelEnum
  from greykite.common.logging import log_message
label_desc: Use image node_id 6 for calling a global function with example usage: infer_freq(df, time_col, window_size) and returns: freq