code: def _find_overlaps(df, max_time=0.05):
      """Merge left/right eye events with onset/offset diffs less than max_time.
  
      Parameters
      ----------
      df : pandas.DataFrame
          Pandas DataFrame with occular events (fixations, saccades, blinks)
      max_time : float (default 0.05)
          Time in seconds. Defaults to .05 (50 ms)
  
      Returns
      -------
      DataFrame: %(df_return)s
          :class:`pandas.DataFrame` specifying overlapped eye events, if any
  
      Notes
      -----
      The idea is to cumulative sum the boolean values for rows with onset and
      offset differences (against the previous row) that are greater than the
      max_time. If onset and offset diffs are less than max_time then no_overlap
      will become False. Alternatively, if either the onset or offset diff is
      greater than max_time, no_overlap becomes True. Cumulatively summing over
      these boolean values will leave rows with no_overlap == False unchanged
      and hence with the same group number.
      """
      pd = _check_pandas_installed()
  
      if not len(df):
          return
      df["overlap_start"] = (
          df.sort_values("time")["time"].diff().lt(max_time)
      )
  
      df["overlap_end"] = df["end_time"].diff().abs().lt(max_time)
  
      df["no_overlap"] = ~(df["overlap_end"] & df["overlap_start"])
      df["group"] = df["no_overlap"].cumsum()
  
      # now use groupby on 'group'. If one left and one right eye in group
      # the new start/end times are the mean of the two eyes
      ovrlp = pd.concat(
          [
              pd.DataFrame(g[1].drop(columns="eye").mean()).T
              if (len(g[1]) == 2) and (len(g[1].eye.unique()) == 2)
              else g[1]  # not an overlap, return group unchanged
              for g in df.groupby("group")
          ]
      )
      # overlapped events get a "both" value in the "eye" col
      if "eye" in ovrlp.columns:
          ovrlp["eye"] = ovrlp["eye"].fillna("both")
      else:
          ovrlp["eye"] = "both"
      tmp_cols = ["overlap_start", "overlap_end", "no_overlap", "group"]
      return ovrlp.drop(columns=tmp_cols).reset_index(drop=True)
  
imports: import re
  from datetime import datetime, timedelta, timezone
  import numpy
  from ..._fiff.constants import FIFF
  from ..._fiff.meas_info import create_info
  from ...annotations import Annotations
  from ...utils import _check_pandas_installed, logger, warn
label_desc: Use image node_id 17 for calling a global function with example usage: _find_overlaps(df, max_time) and returns: ovrlp