'How to rewrite ta.barssince to python?

Anyone know how to rewrite ta.barssince function in python3?
ta.barssince(rsi <= rsi_over_sold) <= 5



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source