<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _unpad(self, a, axis, out):
 """Undo padding in an array. Parameters array to be trimmed to size `Nin` axis : int axis along which to unpad out : bool trim the output if True, otherwise the input; the two cases have their left and right pad sizes reversed """


        assert a.shape[axis] == self.N

        Npad = self.N - self.Nin
        if out:
            _Npad, Npad_ = Npad - Npad//2, Npad//2
        else:
            _Npad, Npad_ = Npad//2, Npad - Npad//2

        return np.take(a, range(_Npad, self.N - Npad_), axis=axis)