This should be changed in Astropy core to be re-usable.
If you want to merge this now, please add a `TODO:` line saying that it should be removed here when available in Astropy ... or put it in `gammapy/extern` if it's a copy of code from Astropy.