MAINT: Extract repeated code to a helper function
MAINT: Extract repeated code to a helper function

These pieces of code were identical, and this is just a move.

numpy/numpy,simongibbons/numpy,mattip/numpy,WarrenWeckesser/numpy,pbrod/numpy,rgommers/numpy,rgommers/numpy,jakirkham/numpy,endolith/numpy,grlee77/numpy,grlee77/numpy,madphysicist/numpy,numpy/numpy,endolith/numpy,madphysicist/numpy,abalkin/numpy,grlee77/numpy,simongibbons/numpy,jakirkham/numpy,mattip/numpy,rgommers/numpy,madphysicist/numpy,charris/numpy,endolith/numpy,WarrenWeckesser/numpy,mhvk/numpy,anntzer/numpy,WarrenWeckesser/numpy,charris/numpy,endolith/numpy,mhvk/numpy,pdebuyl/numpy,mhvk/numpy,numpy/numpy,seberg/numpy,grlee77/numpy,mattip/numpy,abalkin/numpy,mattip/numpy,jakirkham/numpy,pbrod/numpy,madphysicist/numpy,abalkin/numpy,pbrod/numpy,seberg/numpy,numpy/numpy,anntzer/numpy,seberg/numpy,pbrod/numpy,mhvk/numpy,madphysicist/numpy,jakirkham/numpy,grlee77/numpy,simongibbons/numpy,charris/numpy,pdebuyl/numpy,pdebuyl/numpy,jakirkham/numpy,pbrod/numpy,seberg/numpy,mhvk/numpy,simongibbons/numpy,anntzer/numpy,rgommers/numpy,simongibbons/numpy,WarrenWeckesser/numpy,WarrenWeckesser/numpy,charris/numpy,pdebuyl/numpy,anntzer/numpy