maybe move this to a ``utils.py`` file?