Fixed NameError on Python 3
Fixed doctest failures on _permission_mask
Update doctest in .chunks for correctness and so it actually passes.
Doctest modules by default.