please change this to `assert isinstance(axis, int), "Expected 'axis' to be an int. Got: %r" % axis` (since we're assuming that this check is made already by callers - so it's a completely internal error.