def apply_customization(self, serializer, customization):
        """
        Applies fields customization to a nested or embedded DocumentSerializer.
        """
        # apply fields or exclude
        if customization.fields is not None:
            if len(customization.fields) == 0:
                # customization fields are empty, set Meta.fields to '__all__'
                serializer.Meta.fields = ALL_FIELDS
            else:
                serializer.Meta.fields = customization.fields
        if customization.exclude is not None:
            serializer.Meta.exclude = customization.exclude

        # apply extra_kwargs
        if customization.extra_kwargs is not None:
            serializer.Meta.extra_kwargs = customization.extra_kwargs

        # apply validate_methods
        for method_name, method in customization.validate_methods.items():
            setattr(serializer, method_name, method)
Applies fields customization to a nested or embedded DocumentSerializer.