def METHOD_NAME(self, i):
    # We would like it so that, where possible, shrinking replaces
    # characters with simple ascii characters, so we rejig this
    # bit so that the smallest values are 0, 1, 2, ..., Z.
    #
    # Imagine that numbers are laid out as abc0yyyZ...
    # this rearranges them so that they are laid out as
    # 0yyyZcba..., which gives a better shrinking order.
    if i <= self.Z_point:
        # We want to rewrite the integers [0, n] inclusive
        # to [zero_point, Z_point].
        n = self.Z_point - self.zero_point
        if i <= n:
            i += self.zero_point
        else:
            # We want to rewrite the integers [n + 1, Z_point] to
            # [zero_point, 0] (reversing the order so that codepoints below
            # zero_point shrink upwards).
            i = self.zero_point - (i - n)
            assert i < self.zero_point
        assert 0 <= i <= self.Z_point
    return i