I guess I had two reasons for making a separate function. One was that I thought this might be reused, which hasn't happened. The other is that I think it makes it much more descriptive: as @drasmuss says, most people who read `_check_shapes` don't care how we check if a function is in the stack. Leaving it as a separate function lets anyone who reads `check_shapes` have a general idea of what's going on, whereas if we do it inline, anyone who reads the function will have to try to figure out what `self.__init__ in [record[0].f_code for record in inspect.stack()]` does. How about keeping the function `_in_stack`, keeping it in `objects.py`, but putting it at the bottom of the file? We've tended to put helper stuff at the tops of files, but I'm starting to think the bottom of files is the place to put these types of things.