The story of how a roguish, beloved New Zealand bird was nearly eradicated.