def METHOD_NAME(self, instance) -> typing.Optional[typing.Dict[str, typing.Any]]:
    if getattr(instance, "feature_segment_id", None) is not None:
        return IdentityAllFeatureStatesSegmentSerializer(
            instance=instance.feature_segment.segment
        ).data
    return None