copy of mtspec woring with python3