Rewrited in python with charmhelpers. Initial commit