code: def maybe_infer_freq(freq):
      
      freq_infer = False
      if not isinstance(freq, DateOffset):
          # if a passed freq is None, don't infer automatically
          if freq != 'infer':
              freq = frequencies.to_offset(freq)
          else:
              freq_infer = True
              freq = None
      return freq, freq_infer
docs: Comparing a DateOffset to the string "infer" raises, so we need to
      be careful about comparisons.  Make a dummy variable `freq_infer` to
      signify the case where the given freq is "infer" and set freq to None
      to avoid comparison trouble later on.
  
      Parameters
      ----------
      freq : {DateOffset, None, str}
  
      Returns
      -------
      freq : {DateOffset, None}
      freq_infer : bool