Check if handler is an instance method before looking for docs

This checks that the handler is a class instance method before using the im_class member, so handlers can be bare functions too.