Done with porting the median BT algo to pyhton