How To Write A Boolean Function In Python