Typescript If Else Statement Python