this is general enough that it might make sense to move this to `__init__.py` as a general utility function.