add python code for ensemble