# Path: textplusstuff/exceptions.py
# class InvalidRenderOption(Exception):
#     pass
# 
# class NotRegistered(Exception):
#     pass
# 
# class MissingRendition(Exception):
#     pass
# 
# Path: textplusstuff/registry.py
# class Rendition(object):
# class Stuff(object):
# class ModelStuff(Stuff):
#         class ListSerializer(ModelSerializer):
#             class Meta:
# class StuffRegistry(object):
#         class ListStuffGroups(TextPlusStuffAPIViewMixIn, APIView):
#     def __init__(self, short_name, verbose_name, description,
#                  path_to_template, rendition_type='block'):
#     def get_context_data(self, **context):
#     def render_as_html(self, context):
#     def __init__(self, model):
#     def _verify_rendition(self, rendition):
#     def _verify_rendition_list_uniqueness(self, rendition_list):
#     def _verify_and_build_initial_rendition_dict(self):
#     def register_non_core_rendition(self, rendition):
#     def get_list_serializer(self):
#     def list_view(self):
#     def detail_view(self):
#     def get_url_name_key(self):
#     def get_urls(self):
#     def __init__(self, name='stuff_registry'):
#     def verify_stuff_cls(self, stuff_cls):
#     def verify_groups(self, groups, stuff_cls):
#     def add_modelstuff(self, model, stuff_cls, groups=[]):
#     def add_noncore_modelstuff_rendition(self, model, rendition):
#     def remove_modelstuff(self, model):
#     def index(self):
#             def prepare_stuffgroups(self):
#             def get_generated_stuffgroups(self):
#             def get(self, request, format=None):
#     def get_urls(self):
#     def urls(self):
# def get_modelstuff_renditions(model_instance):


from django.contrib.contenttypes.models import ContentType
from django.utils.encoding import force_str
from bs4 import BeautifulSoup
from markdown2 import Markdown
from ..exceptions import InvalidRenderOption, NotRegistered, MissingRendition
from ..registry import stuff_registry
        try:
            ct = ContentType.objects.get(
                app_label=app_label,
                model=model_as_str
            )
        except ContentType.DoesNotExist:
            raise ContentType.DoesNotExist(
                "No ContentType instance could be retrieved with the "
                "app_label: {} and the model: {}.".format(
                    app_label, model_as_str
                )
            )
        else:
            return ct

    def get_model_class(self):
        """
        Returns the model class associated with self.node_mapping
        """
        ct = self.get_contenttype()
        return ct.model_class()

    def get_stuff_config(self):
        """
        Returns the StuffConfig instance associated with this Node.
        """
        # Step 1: Get Model associated with token
        model_cls = self.get_model_class()
        # Step 2: Find the model in stuff_registry._registry
        try:

# Path: textplusstuff/exceptions.py
# class InvalidRenderOption(Exception):
#     pass
# 
# class NotRegistered(Exception):
#     pass
# 
# class MissingRendition(Exception):
#     pass
# 
# Path: textplusstuff/registry.py
# class Rendition(object):
# class Stuff(object):
# class ModelStuff(Stuff):
#         class ListSerializer(ModelSerializer):
#             class Meta:
# class StuffRegistry(object):
#         class ListStuffGroups(TextPlusStuffAPIViewMixIn, APIView):
#     def __init__(self, short_name, verbose_name, description,
#                  path_to_template, rendition_type='block'):
#     def get_context_data(self, **context):
#     def render_as_html(self, context):
#     def __init__(self, model):
#     def _verify_rendition(self, rendition):
#     def _verify_rendition_list_uniqueness(self, rendition_list):
#     def _verify_and_build_initial_rendition_dict(self):
#     def register_non_core_rendition(self, rendition):
#     def get_list_serializer(self):
#     def list_view(self):
#     def detail_view(self):
#     def get_url_name_key(self):
#     def get_urls(self):
#     def __init__(self, name='stuff_registry'):
#     def verify_stuff_cls(self, stuff_cls):
#     def verify_groups(self, groups, stuff_cls):
#     def add_modelstuff(self, model, stuff_cls, groups=[]):
#     def add_noncore_modelstuff_rendition(self, model, rendition):
#     def remove_modelstuff(self, model):
#     def index(self):
#             def prepare_stuffgroups(self):
#             def get_generated_stuffgroups(self):
#             def get(self, request, format=None):
#     def get_urls(self):
#     def urls(self):
# def get_modelstuff_renditions(model_instance):


# Path: textplusstuff/parser/nodes.py
from django.contrib.contenttypes.models import ContentType
from django.utils.encoding import force_str
from bs4 import BeautifulSoup
from markdown2 import Markdown
from ..exceptions import InvalidRenderOption, NotRegistered, MissingRendition
from ..registry import stuff_registry

        try:
            ct = ContentType.objects.get(
                app_label=app_label,
                model=model_as_str
            )
        except ContentType.DoesNotExist:
            raise ContentType.DoesNotExist(
                "No ContentType instance could be retrieved with the "
                "app_label: {} and the model: {}.".format(
                    app_label, model_as_str
                )
            )
        else:
            return ct

    def get_model_class(self):
        """
        Returns the model class associated with self.node_mapping
        """
        ct = self.get_contenttype()
        return ct.model_class()

    def get_stuff_config(self):
        """
        Returns the StuffConfig instance associated with this Node.
        """
        # Step 1: Get Model associated with token
        model_cls = self.get_model_class()
        # Step 2: Find the model in stuff_registry._registry
        try:

            stuff_config, groups = stuff_registry._registry[