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 
Nevermind, I get it now.  Since both are strings the `str.__contains__` checks if the left string is a substring of the right right string a la `'abc' in 'abcdefg'`  (if it were anything else it would treat `'class'` as an iterable of characters).  So yes, 'class' *is* in 'class'.  I was just having a slow moment.

Still should be fixed though :)