Monoids for python