def get_collection_iterator(collection_name, find={}, criteria=None):
    collection = db[collection_name]
if collection is None:
    err_msg = 'Mongo could not return the collecton - ' + collection_name
logging.error(err_msg)
raise Exception(err_msg)
collection = collection.find(find, criteria)
for doc in collection:
    yield doc
pymongo generator fails - 'return' with argument inside generator