CustomStack.py by Cyrille Lefevre