async def METHOD_NAME(
    io: IO,
    notebook_id: UUID,
    dry_run: bool = False,
    bypass_fresh_data_check: bool = False,
) -> Response:
    response = Response()
    notebook: Notebook = await io.find_notebook(notebook_id)
    if not notebook:
        logger.error("[notebook_id: %s] No notebook found", notebook_id)
        return response
    if not notebook.nir:
        logger.debug("[notebook_id: %s] No NIR for notebook", notebook_id)
        return response
    if not notebook.deployment_config.get(DEPLOYMENT_CONFIG_ENABLE_PE_DIAGNOSTIC_API):
        logger.debug(
            "[notebook_id: %s] PE diagnostic api not enabled for current "
            "notebook deployment",
            notebook_id,
        )
        return response
    response.has_pe_diagnostic = notebook.has_pe_diagnostic()
    if notebook.has_fresh_pe_data() and not bypass_fresh_data_check:
        logger.debug(
            "[notebook_id: %s] No fresh data for notebook (<1 hour), skipping",
            notebook_id,
        )
        return response
    # Connnect to the Pôle emploi API
    dossier: DossierIndividuData | None = await io.get_dossier_pe(
        notebook.nir, notebook.date_of_birth
    )
    await io.update_diagnostic_fetch_date(notebook_id)
    # TODO: Quand on a un dossier qui nous revient à None
    #  alors qu'on avait des données on en fait rien,
    #  on ne devrait pas supprimer ?
    if dossier is None:
        logger.error(
            "[notebook_id: %s] No PE dossier found for nir '%s' and date of birth '%s'",
            notebook_id,
            notebook.nir,
            notebook.date_of_birth,
        )
        return response
    else:
        if dry_run:
            logger.info(
                "[notebook_id: %s] PE dossier found for nir '%s' "
                "and date of birth '%s'",
                notebook_id,
                notebook.nir,
                notebook.date_of_birth,
            )
            logger.debug(
                "[notebook_id: %s] PE dossier %s",
                notebook_id,
                dossier.json(),
            )
    if notebook.last_diagnostic_hash == dossier.hash():
        logger.debug(
            "[notebook_id: %s] Last diagnostic is the same than PE, skipping",
            notebook_id,
        )
        return response
    if not dry_run:
        await io.save_in_external_data(dossier, notebook.beneficiary_id)
    else:
        logger.info(
            "[notebook_id: %s] Skipping saving in external data, dry-run activated",
            notebook_id,
        )
    response.has_pe_diagnostic = True
    response.external_data_has_been_updated = True
    if not settings.ENABLE_SYNC_CONTRAINTES:
        logger.debug(
            "[notebook_id: %s] ENABLE_SYNC_CONTRAINTES flag to false, skipping sync",
            notebook_id,
        )
        return response
    # Get Cdb situation repository from Graphql
    ref_situations = await io.get_ref_situations()
    situation_differences, focus_differences = await compare(
        dossier, notebook, ref_situations
    )
    if (
        situation_differences.situations_to_add
        or situation_differences.situations_to_delete
        or focus_differences.focuses_to_add
        or focus_differences.focus_ids_to_delete
        or focus_differences.target_differences.targets_to_add
        or focus_differences.target_differences.target_ids_to_end
        or focus_differences.target_differences.target_ids_to_cancel
    ) and not dry_run:
        await io.save_differences(situation_differences, focus_differences, notebook_id)
        response.data_has_been_updated = True
    if dry_run:
        logger.info(
            "[notebook_id: %s] Skipping saving differences, dry-run activated",
            notebook_id,
        )
        logger.info(
            "[notebook_id: %s] Situation differences %s",
            notebook_id,
            situation_differences,
        )
        logger.info(
            "[notebook_id: %s] Focus differences %s", notebook_id, focus_differences
        )
    return response