Logic is hard and a 'not' was missing.

patch_document is still required but should hopefully work in python 2
and 3 now