def resolve_template(code: Union[(Template, str)]) -> str:
    '\n    Resolves a template code from a :class:`~discord.Template`, URL or code.\n\n    .. versionadded:: 1.4\n\n    Parameters\n    -----------\n    code: Union[:class:`~discord.Template`, :class:`str`]\n        The code.\n\n    Returns\n    --------\n    :class:`str`\n        The template code.\n    '
    from .template import Template
    if isinstance(code, Template):
        return code.code
    else:
        rx = '(?:https?\\:\\/\\/)?discord(?:\\.new|(?:app)?\\.com\\/template)\\/(.+)'
        m = re.match(rx, code)
        if m:
            return m.group(1)
    return code
Resolves a template code from a :class:`~discord.Template`, URL or code.

.. versionadded:: 1.4

Parameters
-----------
code: Union[:class:`~discord.Template`, :class:`str`]
    The code.

Returns
--------
:class:`str`
    The template code.
def resolve_template(code: Union[(Template, str)]) -> str:
    '\n    Resolves a template code from a :class:`~discord.Template`, URL or code.\n\n    .. versionadded:: 1.4\n\n    Parameters\n    -----------\n    code: Union[:class:`~discord.Template`, :class:`str`]\n        The code.\n\n    Returns\n    --------\n    :class:`str`\n        The template code.\n    '
    from .template import Template
    if isinstance(code, Template):
        return code.code
    else:
        rx = '(?:https?\\:\\/\\/)?discord(?:\\.new|(?:app)?\\.com\\/template)\\/(.+)'
        m = re.match(rx, code)
        if m:
            return m.group(1)
    return code