Stack expression utility functions for Python