Logical Function In Python Definition