Python submission: inspecting the call stack

A Python solution that inspects the callstack to compute the correct output