old_contents: from markdown import markdown as markdown_function
  
  from django.conf import settings
  from django.utils.encoding import force_text
  
  from rest_framework import serializers
  
  from rdmo.core.utils import get_languages
  
  
  class RecursiveField(serializers.Serializer):
  
      def to_representation(self, value):
          serializer = self.parent.parent.__class__(value, context=self.context)
          return serializer.data
  
  
  class ChoicesSerializer(serializers.Serializer):
      id = serializers.SerializerMethodField()
      text = serializers.SerializerMethodField()
  
      def get_id(self, obj):
          return obj[0]
  
      def get_text(self, obj):
          return obj[1]
  
  
  class MarkdownSerializerMixin(serializers.Serializer):
  
      markdown_fields = ()
  
      def to_representation(self, instance):
          response = super(MarkdownSerializerMixin, self).to_representation(instance)
  
          for markdown_field in self.markdown_fields:
              if markdown_field in response and response[markdown_field]:
                  response[markdown_field] = markdown_function(force_text(response[markdown_field]))
  
          return response
  
  
  class TranslationSerializerMixin(object):
  
      def __init__(self, *args, **kwargs):
          super(TranslationSerializerMixin, self).__init__(*args, **kwargs)
  
          meta = getattr(self, 'Meta', None)
          if meta:
              for lang_code, lang_string, lang_field in get_languages():
                  for field in meta.trans_fields:
                          field_name = '%s_%s' % (field, lang_field)
                          model_field = meta.model._meta.get_field(field_name)
  
                          self.fields['%s_%s' % (field, lang_code)] = serializers.CharField(
                              source=field_name,
                              required=not model_field.blank,
                              allow_null=model_field.null,
                              allow_blank=model_field.blank)
  
new_contents: from markdown import markdown as markdown_function
  
  from django.conf import settings
  from django.utils.encoding import force_text
  
  from rest_framework import serializers
  
  from rdmo.core.utils import get_languages
  
  
  class RecursiveField(serializers.Serializer):
  
      def to_representation(self, value):
          serializer = self.parent.parent.__class__(value, context=self.context)
          return serializer.data
  
  
  class ChoicesSerializer(serializers.Serializer):
      id = serializers.SerializerMethodField()
      text = serializers.SerializerMethodField()
  
      def get_id(self, obj):
          return obj[0]
  
      def get_text(self, obj):
          return obj[1]
  
  
  class MarkdownSerializerMixin(serializers.Serializer):
  
      markdown_fields = ()
  
      def to_representation(self, instance):
          response = super(MarkdownSerializerMixin, self).to_representation(instance)
  
          for markdown_field in self.markdown_fields:
              if markdown_field in response and response[markdown_field]:
                  response[markdown_field] = markdown_function(force_text(response[markdown_field]))
  
          return response
  
  
  class TranslationSerializerMixin(object):
  
      def __init__(self, *args, **kwargs):
          super(TranslationSerializerMixin, self).__init__(*args, **kwargs)
  
          meta = getattr(self, 'Meta', None)
          if meta:
              for lang_code, lang_string, lang_field in get_languages():
                  for field in meta.trans_fields:
                      field_name = '%s_%s' % (field, lang_field)
                      model_field = meta.model._meta.get_field(field_name)
  
                      self.fields['%s_%s' % (field, lang_code)] = serializers.CharField(
                          source=field_name,
                          required=not model_field.blank,
                          allow_null=model_field.null,
                          allow_blank=model_field.blank)
  
subject: Fix indentation