PDF name of the colorspace that best describes this image

def colorspace(self):
        """PDF name of the colorspace that best describes this image"""
        if self.image_mask:
            return None  # Undefined for image masks
        if self._colorspaces:
            if self._colorspaces[0] in self.SIMPLE_COLORSPACES:
                return self._colorspaces[0]
            if self._colorspaces[0] == '/DeviceCMYK':
                return self._colorspaces[0]
            if (
                self._colorspaces[0] == '/Indexed'
                and self._colorspaces[1] in self.SIMPLE_COLORSPACES
            ):
                return self._colorspaces[1]
            if self._colorspaces[0] == '/ICCBased':
                icc = self._colorspaces[1]
                return icc.stream_dict.get('/Alternate', '')
        raise NotImplementedError(
            "not sure how to get colorspace: " + repr(self._colorspaces)
        )