def maybe_infer_freq(freq):
freq_infer = False<EOL>if not isinstance(freq, DateOffset):<EOL><INDENT>if freq != '<STR_LIT>':<EOL><INDENT>freq = frequencies.to_offset(freq)<EOL><DEDENT>else:<EOL><INDENT>freq_infer = True<EOL>freq = None<EOL><DEDENT><DEDENT>return freq, freq_infer<EOL>
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