Python legb rule example