turning it into ruby from python