def get_annotated_type(
    api: SemanticAnalyzer | TypeChecker, model_type: Instance, fields_dict: TypedDictType
) -> ProperType:
    """
    Get a model type that can be used to represent an annotated model
    """
    if model_type.extra_attrs:
        extra_attrs = ExtraAttrs(
            attrs={**model_type.extra_attrs.attrs, **(fields_dict.items if fields_dict is not None else {})},
            immutable=model_type.extra_attrs.immutable.copy(),
            mod_name=None,
        )
    else:
        extra_attrs = ExtraAttrs(
            attrs=fields_dict.items if fields_dict is not None else {},
            immutable=None,
            mod_name=None,
        )

    annotated_model: TypeInfo | None
    if helpers.is_annotated_model(model_type.type):
        annotated_model = model_type.type
        if model_type.args:
            annotations = get_proper_type(model_type.args[0])
            if isinstance(annotations, TypedDictType):
                fields_dict = helpers.make_typeddict(
                    api,
                    fields={**annotations.items, **fields_dict.items},
                    required_keys={*annotations.required_keys, *fields_dict.required_keys},
                    readonly_keys={*annotations.readonly_keys, *fields_dict.readonly_keys},
                )
    else:
        annotated_model = helpers.lookup_fully_qualified_typeinfo(api, model_type.type.fullname + "@AnnotatedWith")

    if annotated_model is None:
        return model_type
    return Instance(annotated_model, [fields_dict], extra_attrs=extra_attrs)

    Get a model type that can be used to represent an annotated model
    
mypy_django_plugin/transformers/models.py