final draft bwt.py