MAINT: Create a common version of `count_nonzero` for compatibility with numpy 1.5.