modified code to conform to pep