def _raise_on_incompatible(left, right):
<EOL>if isinstance(right, np.ndarray):<EOL><INDENT>other_freq = None<EOL><DEDENT>elif isinstance(right, (ABCPeriodIndex, PeriodArray, Period, DateOffset)):<EOL><INDENT>other_freq = right.freqstr<EOL><DEDENT>else:<EOL><INDENT>other_freq = _delta_to_tick(Timedelta(right)).freqstr<EOL><DEDENT>msg = DIFFERENT_FREQ.format(cls=type(left).__name__,<EOL>own_freq=left.freqstr,<EOL>other_freq=other_freq)<EOL>raise IncompatibleFrequency(msg)<EOL>
Helper function to render a consistent error message when raising
IncompatibleFrequency.

Parameters
----------
left : PeriodArray
right : DateOffset, Period, ndarray, or timedelta-like

Raises
------
IncompatibleFrequency