Monotonic Stack Implementation Using Python For Data