I recently published my first ever Python module to PyPi – macusers. It simplifies getting the current logged in user even when the script is running as root or at login window. I’ve been using the code for a long time now in my Munki scripts and custom packages.