impreved python wrapper