def output(self) -> str | None:
        """
        Generate output for any cuPyNumeric Doctor results in the specified
        format.

        Returns:
            str

        """
        if not self.results:
            return None

        try:
            out = io.StringIO()
            match settings.doctor_format():
                case "plain":
                    self._write_plain(out)
                case "json":
                    self._write_json(out)
                case "csv":
                    self._write_csv(out)
            return out.getvalue()
        except Exception as e:
            warnings.warn(
                "cuPyNumeric Doctor detected issues, but an exception "
                f"occurred generating output (no output was written): {e}"
            )
            return None

        Generate output for any cuPyNumeric Doctor results in the specified
        format.

        Returns:
            str

        
cupynumeric/_array/doctor.py