You can write a plain ol’ Python module and install it—it should then be importable by any Python code, including inline snippets.
You can write a plain ol’ Python module and install it—it should then be importable by any Python code, including inline snippets.