def METHOD_NAME(
    dc: Datacube, csv_path: str, update_if_exists: Optional[bool] = False
) -> Tuple[int, int, int]:
    # Parse csv file
    new_products = list(_parse_csv(csv_path))
    logging.info("Found %s products in the CSV %s", len(new_products), csv_path)
    # List existing products
    products = dc.list_products(with_pandas=False)
    existing_names = [product["name"] for product in products]
    logging.info("Found %s products in the Datacube", len(existing_names))
    added, updated, failed = 0, 0, 0
    for product in new_products:
        if product.doc is None:
            failed += 1
            continue
        # Add new products
        try:
            if product.name not in existing_names:
                dc.index.products.add_document(product.doc)
                added += 1
                logging.info("Added product %s", product.name)
            # Update existing products, if required
            elif update_if_exists:
                dc.index.products.update_document(
                    product.doc, allow_unsafe_updates=True
                )
                updated += 1
                logging.info("Updated product %s", product.name)
        except Exception:  # pylint:disable=broad-except
            failed += 1
            logging.exception("Failed to add/update product %s", product.name)
    # Return results
    return added, updated, failed