<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def accuracy_score(df, col_true=None, col_pred=None, normalize=True):
 """ Compute accuracy of a predicted DataFrame. Note that this method will trigger the defined flow to execute. :param df: predicted data frame :type df: DataFrame :param col_true: column name of true label :type col_true: str :param col_true: column name of predicted label, 'prediction_result' by default. :type col_pred: str :param normalize: denoting if the output is normalized between [0, 1] :type normalize: bool :return: Accuracy value :rtype: float """

    if not col_pred:
        col_pred = get_field_name_by_role(df, FieldRole.PREDICTED_CLASS)
    mat, _ = _run_cm_node(df, col_true, col_pred)
    if np is not None:
        acc_count = np.sum(np.diag(mat))
        if not normalize:
            return acc_count
        else:
            return acc_count * 1.0 / np.sum(mat)
    else:
        diag_sum = mat_sum = 0
        mat_size = len(mat)
        for i in compat.irange(mat_size):
            for j in compat.irange(mat_size):
                if i == j:
                    diag_sum += mat[i][j]
                mat_sum += mat[i][j]
        if not normalize:
            return diag_sum
        else:
            return diag_sum * 1.0 / mat_sum