human
I wrote the below code

    def wrapper(self, other):
        if isinstance(other, Period):
            func = getattr(self._values, opname)
            (other_base, _) = _gfc(other.freq)
            if (other.freq != self.freq):
                msg = _DIFFERENT_FREQ_INDEX.format(self.freqstr, other.freqstr)
                raise IncompatibleFrequency(msg)
            result = func(other.ordinal)
        elif isinstance(other, PeriodIndex):
            if (other.freq != self.freq):
                msg = _DIFFERENT_FREQ_INDEX.format(self.freqstr, other.freqstr)
                raise IncompatibleFrequency(msg)
            result = getattr(self._values, opname)(other._values)
            mask = (self._isnan | other._isnan)
            if mask.any():
                result[mask] = nat_result
            return result
        elif (other is tslib.NaT):
            result = np.empty(len(self._values), dtype=bool)
            result.fill(nat_result)
        else:
            other = Period(other, freq=self.freq)
            func = getattr(self._values, opname)
            result = func(other.ordinal)
        if self.hasnans:
            result[self._isnan] = nat_result
        return result
    return wrapper

What's a good function header?

=====
Here's a good function header?
assistant
#Here's a good function header.

def _period_index_cmp(opname, nat_result=False):