more bash to python conversions