Python 3 compatibility for Rule class