[py] Fix possible TypeError in expected conditions (#15891)

Co-authored-by: Corey Goldberg <[email protected]>
NOKEYCHECK=True
GitOrigin-RevId: babd957d6cf93b36fd4296ba41ddcfefc4459e11
1 file changed