[Huggle] Major rewrite of python engine