How, from Python, do I check if a given RA, Dec is in an exposure?

How do I easily check if a given RA, Dec is in an exposure from Python?
I have calexp in a repository, and want to check if a given RA, Dec is in that particular image.

@yusra says

“The butler lets you get the wcs and bbox without reading the whole image. Then I usually compare the corners.”

@ctslater says

"exp.getBBox().contains(exp.getWcs().skyToPixel(coord)) is almost there
but [it’s not quite there] because skyToPixel() returns Point2D while exp.getBBox() is Box2I, and they don’t convert automatically"

I’d go with @ctslater. It is trivial to cast a BoxI to a BoxD:

boxd = afwGeom.Box2D(exp.getBBox())

And of course @yusra makes an excellent point: if you don’t have the exposure; it’s more efficient to just read in the WCS and bbox without the pixels.

I suggest you embed your skyToPixel call in a try block: it can raise an exception if the coordinates are a long way off the image.