Sphinx smart resolve Bases from intersphinx for affiliated packages

Some of the ``Bases`` links are broken and seems unfixable in affiliated packages.  Examples are in this issue of photutils: https://github.com/astropy/photutils/issues/152

(e.g. as the ``Bases`` of a class, ``astropy.modeling.core.Fittable2DModel`` isn't resolved to ``astropy.modeling.Fittable2DModel``)

This PR fixes this issue in photutils. I've also tested it with the core astropy, and it didn't broke anything there.

cc: @astrofrog 
Here and in some places below I think that if you have a lengthy condition in an if statement my preference is to wrap the whole things in parens and use implicit line continuations.