MAINT: move a numpy compatibility function into its own file