def load_from_definition(
        self, resource_name, single_resource_json_definition, service_context
    ):
        """
        Loads a resource from a model, creating a new
        :py:class:`~boto3.resources.base.ServiceResource` subclass
        with the correct properties and methods, named based on the service
        and resource name, e.g. EC2.Instance.

        :type resource_name: string
        :param resource_name: Name of the resource to look up. For services,
                              this should match the ``service_name``.

        :type single_resource_json_definition: dict
        :param single_resource_json_definition:
            The loaded json of a single service resource or resource
            definition.

        :type service_context: :py:class:`~boto3.utils.ServiceContext`
        :param service_context: Context about the AWS service

        :rtype: Subclass of :py:class:`~boto3.resources.base.ServiceResource`
        :return: The service or resource class.
        """
        logger.debug(
            'Loading %s:%s', service_context.service_name, resource_name
        )

        # Using the loaded JSON create a ResourceModel object.
        resource_model = ResourceModel(
            resource_name,
            single_resource_json_definition,
            service_context.resource_json_definitions,
        )

        # Do some renaming of the shape if there was a naming collision
        # that needed to be accounted for.
        shape = None
        if resource_model.shape:
            shape = service_context.service_model.shape_for(
                resource_model.shape
            )
        resource_model.load_rename_map(shape)

        # Set some basic info
        meta = ResourceMeta(
            service_context.service_name, resource_model=resource_model
        )
        attrs = {
            'meta': meta,
        }

        # Create and load all of attributes of the resource class based
        # on the models.

        # Identifiers
        self._load_identifiers(
            attrs=attrs,
            meta=meta,
            resource_name=resource_name,
            resource_model=resource_model,
        )

        # Load/Reload actions
        self._load_actions(
            attrs=attrs,
            resource_name=resource_name,
            resource_model=resource_model,
            service_context=service_context,
        )

        # Attributes that get auto-loaded
        self._load_attributes(
            attrs=attrs,
            meta=meta,
            resource_name=resource_name,
            resource_model=resource_model,
            service_context=service_context,
        )

        # Collections and their corresponding methods
        self._load_collections(
            attrs=attrs,
            resource_model=resource_model,
            service_context=service_context,
        )

        # References and Subresources
        self._load_has_relations(
            attrs=attrs,
            resource_name=resource_name,
            resource_model=resource_model,
            service_context=service_context,
        )

        # Waiter resource actions
        self._load_waiters(
            attrs=attrs,
            resource_name=resource_name,
            resource_model=resource_model,
            service_context=service_context,
        )

        # Create the name based on the requested service and resource
        cls_name = resource_name
        if service_context.service_name == resource_name:
            cls_name = 'ServiceResource'
        cls_name = service_context.service_name + '.' + cls_name

        base_classes = [ServiceResource]
        if self._emitter is not None:
            self._emitter.emit(
                f'creating-resource-class.{cls_name}',
                class_attributes=attrs,
                base_classes=base_classes,
                service_context=service_context,
            )
        return type(str(cls_name), tuple(base_classes), attrs)

        Loads a resource from a model, creating a new
        :py:class:`~boto3.resources.base.ServiceResource` subclass
        with the correct properties and methods, named based on the service
        and resource name, e.g. EC2.Instance.

        :type resource_name: string
        :param resource_name: Name of the resource to look up. For services,
                              this should match the ``service_name``.

        :type single_resource_json_definition: dict
        :param single_resource_json_definition:
            The loaded json of a single service resource or resource
            definition.

        :type service_context: :py:class:`~boto3.utils.ServiceContext`
        :param service_context: Context about the AWS service

        :rtype: Subclass of :py:class:`~boto3.resources.base.ServiceResource`
        :return: The service or resource class.
        
boto3/resources/factory.py