{%- macro type_hint(type_ref, module_path) %}
    {%- if type_ref is none or type_ref.full_name() == 'None' %}{{ None }}
    {%- elif type_ref.module == module_path | string %}
        {{- type_ref.name }}
    {%- else %}
        {%- if type_ref.module != 'builtins' %}{{ type_ref.module }}.{% endif %}{{ type_ref.name }}
    {%- endif %}
    {%- if type_ref.args is defined %}[
        {%- for arg in type_ref.args %}
            {{- type_hint(arg, module_path) }}{% if not loop.last %}, {% endif %}
    {%- endfor -%}
        ]
    {%- endif %}
{%- endmacro -%}
