def _apply_rule(self, dates):
if self.observance is not None:<EOL><INDENT>return dates.map(lambda d: self.observance(d))<EOL><DEDENT>if self.offset is not None:<EOL><INDENT>if not isinstance(self.offset, list):<EOL><INDENT>offsets = [self.offset]<EOL><DEDENT>else:<EOL><INDENT>offsets = self.offset<EOL><DEDENT>for offset in offsets:<EOL><INDENT>with warnings.catch_warnings():<EOL><INDENT>warnings.simplefilter("<STR_LIT:ignore>", PerformanceWarning)<EOL>dates += offset<EOL><DEDENT><DEDENT><DEDENT>return dates<EOL>
Apply the given offset/observance to a DatetimeIndex of dates.

Parameters
----------
dates : DatetimeIndex
    Dates to apply the given offset/observance rule

Returns
-------
Dates with rules applied