def cohens_kappa(
        self, scores: Union[List[float], List[List]], threshold=0.5
    ) -> float:
        """
        Computes Cohen's Kappa score between true labels and predicted scores.

        Parameters:
        - true_labels (list): A list of true labels.
        - scores (list): A list of predicted labels or scores.

        Returns:
        - float: Cohen's Kappa score.
        """
        if isinstance(scores[0], List):
            scores = [score for score, _ in scores]

        if len(self.true_labels) != len(scores):
            raise ValueError(
                "The length of true_labels and scores must be the same."
            )
        #  convert to categorical if necessary
        if any(isinstance(score, float) for score in scores):
            # threshold at 0.5 for binary classification
            scores = [1 if score >= threshold else 0 for score in scores]

        if any(isinstance(label, float) for label in self.true_labels):
            self.true_labels = [
                1 if label >= threshold else 0 for label in self.true_labels
            ]

        kappa = cohen_kappa_score(self.true_labels, scores)
        return kappa

        Computes Cohen's Kappa score between true labels and predicted scores.

        Parameters:
        - true_labels (list): A list of true labels.
        - scores (list): A list of predicted labels or scores.

        Returns:
        - float: Cohen's Kappa score.
        
src/feedback/trulens/feedback/groundtruth.py