In your sync.py try wrapping all ndb operations inside ndb.Client().context() like:
from google.cloud import ndb
client = ndb.Client()
with client.context():
collection_dbs, collection_cursor = model.Collection.get_dbs( order='name' )
You can refer to this documentation on Python 3 version of ndb client library.
Also, make sure that your service account has the proper permissions to query Datastore.