def _render(node, render_context):
    """
    Render the node depending on its type
    """
    if "template" in node:
        complex_type = False

        if isinstance(node["template"], list) or isinstance(node["template"], dict):
            node["template"] = json_encode(node["template"])

            # Finds occurrences of "{{variable}}" and adds `to_complex` filter
            # so types are honored. If it doesn't follow that syntax then it's
            # rendered as a string.
            node["template"] = re.sub(
                r'"{{([A-z0-9_-]+)}}"', r"{{\1 | to_complex}}", node["template"]
            )
            LOG.debug("Rendering complex type: %s", node["template"])
            complex_type = True

        LOG.debug("Rendering node: %s with context: %s", node, render_context)

        result = ENV.from_string(str(node["template"])).render(render_context)

        LOG.debug("Render complete: %s", result)

        if complex_type:
            result = json_decode(result)
            LOG.debug("Complex Type Rendered: %s", result)

        return result
    if "value" in node:
        return node["value"]

    Render the node depending on its type
    
st2common/st2common/util/param.py