def set(self, value: Optional[T] = None, freeze: bool = False) -> T:
        """Set/Get the value.

        Set the value first if a value is provided. Make it unchangeable if
        freeze is set.

        Raises:
            ValueError: If the setting has already been frozen and the value is
                different from the current value.
        """

        if value is not None:
            if len(self.frozen_by) > 0 and value != self.value:
                freezing_frames = ""
                for frame_str in self.frozen_by:
                    freezing_frames += f"  {frame_str}\n"

                raise ValueError(
                    f"Feature flag has already been set to {self.value} and cannot be changed. "
                    f"It has been frozen here:\n{freezing_frames}"
                )

            self.value = value

        if freeze:
            frame = python_utils.external_caller_frame(offset=1)
            frame_str = python_utils.code_line(frame, show_source=True)
            # Store representation instead of frame to avoid keeping references
            # that would prevent GC.
            self.frozen_by.add(frame_str)

        return self.value
Set/Get the value.

        Set the value first if a value is provided. Make it unchangeable if
        freeze is set.

        Raises:
            ValueError: If the setting has already been frozen and the value is
                different from the current value.
        
src/core/trulens/core/experimental/__init__.py