def METHOD_NAME(
    skale,
    schain_name,
    node_id,
    sgx_key_name,
    rotation_id
):
    keys_data, status = None, None
    dkg_client = None
    try:
        dkg_client = get_dkg_client(
            node_id,
            schain_name,
            skale,
            sgx_key_name,
            rotation_id
        )
        if is_last_dkg_finished(skale, schain_name):
            logger.info(f'Dkg for {schain_name} is completed. Fetching data')
            dkg_client.fetch_all_broadcasted_data()
        elif skale.dkg.is_channel_opened(
            skale.schains.name_to_group_id(schain_name)
        ):
            logger.info(f'Starting dkg procedure for {schain_name}')
            if not skale.dkg.is_channel_opened(
                skale.schains.name_to_group_id(schain_name)
            ):
                status = DKGStatus.FAILED
            else:
                status = DKGStatus.IN_PROGRESS
                init_bls(dkg_client, node_id, sgx_key_name, rotation_id)
    except DkgError as e:
        logger.info(f'sChain {schain_name} DKG procedure failed with {e}')
        status = DKGStatus.FAILED
    if not dkg_client:
        status = DKGStatus.FAILED
    if status != DKGStatus.FAILED:
        try:
            keys_data = generate_bls_keys(dkg_client)
        except DKGKeyGenerationError as e:
            logger.info(
                f'sChain {schain_name} DKG failed during key generation, err {e}')
            status = DKGStatus.KEY_GENERATION_ERROR
    if keys_data:
        status = DKGStatus.DONE
    else:
        if status != DKGStatus.KEY_GENERATION_ERROR:
            status = DKGStatus.FAILED
    return DKGResult(keys_data=keys_data, status=status)