remove unused import
add test for bw_verify
remove xrange for Python 3 compatibility
rewrite LineBuffer and add test