{%- macro return_annotation(success_responses, redirect_response) -%}
	{# This macro generates the return annotation for a function based on the provided success responses and redirect response. #}
	{%- set ns = namespace(return_string="", has_204=false) -%}
	{# Check if any response is 204 No Content #}
	{%- for response in success_responses -%}
		{%- if response.status_code.pattern == '204' -%}
			{%- set ns.has_204 = true -%}
		{%- endif -%}
	{%- endfor -%}
	{# if more than one success response, create a union #}
	{%- if success_responses | length > 1 -%}
		{%- set ns.return_string = "Union[" -%}
		{%- for response in success_responses -%}
			{%- if response.status_code.pattern == '204' -%}
				{%- set ns.return_string = ns.return_string + "None" -%}
			{%- else -%}
				{%- set ns.return_string = ns.return_string + response.prop.get_type_string() -%}
			{%- endif -%}
			{%- if not loop.last -%}
			{%- set ns.return_string = ns.return_string + ", " -%}
			{%- endif -%}
		{%- endfor -%}
		{# if there is a redirect response, add it to the union #}
		{%- if redirect_response | length > 0 -%}
		{%- set ns.return_string = ns.return_string + ", io.BytesIO" -%}
		{%- endif -%}
		{%- set ns.return_string = ns.return_string + "]" -%}
	{# if only one success response and a redirect response, return a union with BytesIO #}
	{%- elif success_responses | length == 1 and redirect_response -%}
		{%- if ns.has_204 -%}
		{%- set ns.return_string = "Union[None, io.BytesIO]" -%}
		{%- else -%}
		{%- set ns.return_string = "Union[" + success_responses[0].prop.get_type_string() + ", io.BytesIO]" -%}
		{%- endif -%}
	{# if only one success response and no redirect response, return the type of that response #}
	{%- elif success_responses | length == 1 -%}
		{%- if ns.has_204 -%}
		{%- set ns.return_string = "None" -%}
		{%- else -%}
		{%- set ns.return_string = success_responses[0].prop.get_type_string() -%}
		{%- endif -%}
	{%- else -%}
	{%- set ns.return_string = "Any" -%}
	{%- endif -%}
	{{- ns.return_string -}}
{%- endmacro -%}
