converting bash to py