ruby to python translation complete, trims each line