Typescript Find Element In Nested If Syntax Python If Function