If you delete the following two lines, the script works.

if DOCUMENTS.startswith("/private"): DOCUMENTS = DOCUMENTS[len("/private"):]