def validate_inferred_freq(freq, inferred_freq, freq_infer):
if inferred_freq is not None:<EOL><INDENT>if freq is not None and freq != inferred_freq:<EOL><INDENT>raise ValueError('<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'<EOL>.format(inferred=inferred_freq,<EOL>passed=freq.freqstr))<EOL><DEDENT>elif freq is None:<EOL><INDENT>freq = inferred_freq<EOL><DEDENT>freq_infer = False<EOL><DEDENT>return freq, freq_infer<EOL>
If the user passes a freq and another freq is inferred from passed data,
require that they match.

Parameters
----------
freq : DateOffset or None
inferred_freq : DateOffset or None
freq_infer : bool

Returns
-------
freq : DateOffset or None
freq_infer : bool

Notes
-----
We assume at this point that `maybe_infer_freq` has been called, so
`freq` is either a DateOffset object or None.