Python port of https://github.com/markitondemand/MOD.Web.Element