def METHOD_NAME(test_class_instance):  # pylint: disable=too-many-branches,too-many-locals
    parent_test_class = None
    for base in test_class_instance.__class__.__bases__:
        if base.__name__.endswith("Test"):
            parent_test_class = base
            break
    else:
        test_class_instance.log.warning(
            "Could not find parent test class. Tenant classes won't inherit anything.")
    tenant_class_name, get_str_index_prefix = f"TenantFor{parent_test_class.__name__}", "k8s"
    if "Performance" in tenant_class_name:
        get_str_index_prefix += "-perf"
    elif "Longevity" in tenant_class_name:
        get_str_index_prefix += "-longevity"
    # Init tenants
    tenants = []
    for i, db_cluster in enumerate(test_class_instance.db_clusters_multitenant):
        current_cluster_index = i + 1
        current_tenant_class = type(
            f"{tenant_class_name}-{current_cluster_index}", (TenantMixin, parent_test_class), {
                "get_str_index_prefix": get_str_index_prefix,
            }
        )
        tenants.append(current_tenant_class(
            db_cluster=db_cluster,
            loaders=test_class_instance.loaders_multitenant[i],
            monitors=test_class_instance.monitors_multitenant[i],
            prometheus_db=test_class_instance.prometheus_db_multitenant[i],
            params=test_class_instance.params,
            test_config=test_class_instance.test_config,
            cluster_index=current_cluster_index,
        ))
    # Process multitenant parameters if present
    for param_dict in test_class_instance.params.config_options:
        param_name = param_dict['name']
        param_value = test_class_instance.params.get(param_name)
        if not (param_dict.get("is_k8s_multitenant_value") and isinstance(param_value, list)):
            continue
        LOGGER.debug(
            "Process multitenant option '%s'. It's value: %s",
            param_name, param_value)
        for i, _ in enumerate(tenants):
            current_param_value = param_value[i]
            if param_name.startswith("stress_") and isinstance(
                    current_param_value, list) and len(current_param_value) == 1:
                # NOTE: performance tests expect only single string values
                #       for the main stress commands. So, transform list of a single str to str.
                current_param_value = current_param_value[0]
            LOGGER.debug(
                "Setting '%s' option of the '%s' tenant with the following value: %s",
                param_name, str(tenants[i]), current_param_value)
            tenants[i].params[param_name] = tenants[i].db_cluster.params[
                param_name] = current_param_value
    return tenants