def correct(self, spans: List[Tuple[str, int, int]]) -> List[Tuple[str, int, int]]:
        """Correct span boundaries for leading/trailing white spaces, new lines and tabs.

        Args:
            spans: Spans to be corrected.

        Returns:
            The corrected spans.
        """
        corrected_spans = []
        for span in spans:
            start, end = span[1], span[2]

            if start < 0:
                start = 0
            if end > len(self.text):
                end = len(self.text)

            while start <= len(self.text) and not self.text[start].strip():
                start += 1
            while not self.text[end - 1].strip():
                end -= 1

            corrected_spans.append((span[0], start, end))

        return corrected_spans
Correct span boundaries for leading/trailing white spaces, new lines and tabs.

        Args:
            spans: Spans to be corrected.

        Returns:
            The corrected spans.
        
argilla-v1/src/argilla_v1/utils/span_utils.py