def METHOD_NAME(resource_group_name, notebook_name):
    logging.info("Terminating Dataengine-service clusters")
    try:
        clusters_list = AzureMeta.list_hdinsight_clusters(resource_group_name)
        if clusters_list:
            for cluster in clusters_list:
                if "notebook_name" in cluster.tags and notebook_name == cluster.tags["notebook_name"]:
                    AzureActions.terminate_hdinsight_cluster(resource_group_name, cluster.name)
                    logging.info('The HDinsight cluster {} has been terminated successfully'.format(cluster.name))
        else:
            logging.info("There are no HDinsight clusters to terminate.")
    except Exception as err:
        datalab.fab.append_result("Failed to terminate dataengine-service", str(err))
        sys.exit(1)
    logging.info("Stopping data engine cluster")
    cluster_list = []
    try:
        for vm in AzureMeta.compute_client.virtual_machines.list(resource_group_name):
            if "notebook_name" in vm.tags:
                if notebook_name == vm.tags['notebook_name']:
                    if 'master' == vm.tags["Type"]:
                        cluster_list.append(vm.tags["Name"])
                    AzureActions.stop_instance(resource_group_name, vm.name)
                    logging.info("Instance {} has been stopped".format(vm.name))
    except Exception as err:
        datalab.fab.append_result("Failed to stop clusters", str(err))
        sys.exit(1)
    logging.info("Stopping notebook")
    try:
        for vm in AzureMeta.compute_client.virtual_machines.list(resource_group_name):
            if "Name" in vm.tags:
                if notebook_name == vm.tags["Name"]:
                    AzureActions.stop_instance(resource_group_name, vm.name)
                    logging.info("Instance {} has been stopped".format(vm.name))
    except Exception as err:
        datalab.fab.append_result("Failed to stop instance", str(err))
        sys.exit(1)