`np.pad` got introduced in 1.7, but that version is shockingly slow for medium-sized rank >= 3 arrays. Because there was an earlier undesired version, the standard Pythonic "`try` and do the stuff after `except` if it breaks" doesn't work.

I've tested this to work as far back as NumPy 1.6.1, and I believe it would work even farther (really just depends on `np.concatenate` which isn't at all new). I deliberately avoided some 1.7 shortcuts for backwards compatibility.