code: def _check_gap(
      window_length: Union[int, str], gap: Union[int, str]
  ) -> None:
      # Gap must either be a valid offset string that also has an offset string window length
      if isinstance(gap, str):
          if not isinstance(window_length, str):
              raise TypeError(
                  f"Cannot roll series with offset gap, {gap}, and numeric window length, {window_length}. "
                  "If an offset alias is used for gap, the window length must also be defined as an offset alias. "
                  "Please either change gap to be numeric or change window length to be an offset alias.",
              )
          try:
              to_offset(gap)
          except ValueError:
              raise ValueError(
                  f"Cannot roll series. The specified gap, {gap}, is not a valid offset alias.",
              )
      # Or an integer greater than or equal to zero
      elif isinstance(gap, int):
          if gap < 0:
              raise ValueError(
                  "Gap must be greater than or equal to zero."
              )
      else:
          raise TypeError(
              "Gap must be either an offset string or an integer."
          )
  
file_path: featuretools/featuretools/primitives/standard/transform/time_series/utils.py
imports: from typing import Callable, Optional, Union
  import numpy
  import pandas
  from pandas import Series
  from pandas.core.window.rolling import Rolling
  from pandas.tseries.frequencies import to_offset
label_desc: Use image node_id 5 for calling a global function with example usage: _check_gap(window_length, gap) without return types