def METHOD_NAME(
    db_session: Session,
    connection: Connection,
    base_dn: types.DN,
    required_property: str | None = None,
) -> None:
    user_base_dn = types.DN(safe_dn(["ou=users", base_dn]))
    group_base_dn = types.DN(safe_dn(["ou=groups", base_dn]))
    property_base_dn = types.DN(safe_dn(["ou=properties", base_dn]))
    db_users = list(
        fetch_db_users(
            session=db_session,
            base_dn=user_base_dn,
            required_property=required_property,
        )
    )
    logger.info("Fetched %s database users", len(db_users))
    db_groups = list(
        fetch_db_groups(
            session=db_session,
            base_dn=group_base_dn,
            user_base_dn=user_base_dn,
        )
    )
    logger.info("Fetched %s database groups", len(db_groups))
    db_properties = list(
        fetch_db_properties(
            session=db_session,
            base_dn=property_base_dn,
            user_base_dn=user_base_dn,
        )
    )
    logger.info("Fetched %s database properties", len(db_properties))
    ldap_users = list(fetch_ldap_users(connection, base_dn=user_base_dn))
    logger.info("Fetched %s ldap users", len(ldap_users))
    ldap_groups = list(fetch_ldap_groups(connection, base_dn=group_base_dn))
    logger.info("Fetched %s ldap groups", len(ldap_groups))
    ldap_properties = list(fetch_ldap_properties(connection, base_dn=property_base_dn))
    logger.info("Fetched %s ldap properties", len(ldap_properties))
    actions = [
        *bulk_diff_records(current=ldap_users, desired=db_users).values(),
        *bulk_diff_records(current=ldap_groups, desired=db_groups).values(),
        *bulk_diff_records(current=ldap_properties, desired=db_properties).values(),
    ]
    for a in actions:
        execute_real(a, connection)