<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def batch_load_docs(db, doc_iterator, on_duplicate="replace"):
 """Batch load documents Args: db: ArangoDB client database handle doc_iterator: function that yields (collection_name, doc_key, doc) on_duplicate: defaults to replace, but can be error, update, replace or ignore https://python-driver-for-arangodb.readthedocs.io/en/master/specs.html?highlight=import_bulk#arango.collection.StandardCollection.import_bulk """


    batch_size = 100

    counter = 0
    collections = {}
    docs = {}

    if on_duplicate not in ["error", "update", "replace", "ignore"]:
        log.error(f"Bad parameter for on_duplicate: {on_duplicate}")
        return

    for (collection_name, doc) in doc_iterator:
        if collection_name not in collections:
            collections[collection_name] = db.collection(collection_name)
            docs[collection_name] = []

        counter += 1

        docs[collection_name].append(doc)

        if counter % batch_size == 0:
            log.info(f"Bulk import arangodb: {counter}")
            for cname in docs:
                collections[cname].import_bulk(
                    docs[cname], on_duplicate=on_duplicate, halt_on_error=False
                )
                docs[cname] = []

    log.info(f"Bulk import arangodb: {counter}")
    for cname in docs:
        collections[cname].import_bulk(
            docs[cname], on_duplicate=on_duplicate, halt_on_error=False
        )
        docs[cname] = []