def dispatch_to_index_op(op, left, right, index_class):
left_idx = index_class(left)<EOL>if getattr(left_idx, '<STR_LIT>', None) is not None:<EOL><INDENT>left_idx = left_idx._shallow_copy(freq=None)<EOL><DEDENT>try:<EOL><INDENT>result = op(left_idx, right)<EOL><DEDENT>except NullFrequencyError:<EOL><INDENT>raise TypeError('<STR_LIT>'<EOL>'<STR_LIT>'.format(name=op.__name__))<EOL><DEDENT>return result<EOL>
Wrap Series left in the given index_class to delegate the operation op
to the index implementation.  DatetimeIndex and TimedeltaIndex perform
type checking, timezone handling, overflow checks, etc.

Parameters
----------
op : binary operator (operator.add, operator.sub, ...)
left : Series
right : object
index_class : DatetimeIndex or TimedeltaIndex

Returns
-------
result : object, usually DatetimeIndex, TimedeltaIndex, or Series