MAINT, TST refactor pickle imports and tests #12133
This PR is essentially the first commit of #12011. If you'd rather merge #12011 directly, feel free to close it.
if sys.version_info >= 3: if sys.version_info in (6, 7): try: import pickle5 as pickle except ImportError: import pickle else: import pickle else: import cPickle as pickle
each time we import pickle in python, we import it once this way, in