@register.filter
def stack_output(output):
    if not output:
        return u''
    if isinstance(output, dict) or isinstance(output, list):
        json_string = json.dumps(output, indent=2)
        safe_output = u'<pre>%s</pre>' % html.escape(json_string)
        return safestring.mark_safe(safe_output)
    if isinstance(output, basestring):
        parts = urlparse.urlsplit(output)
        if parts.netloc and ('http', 'https') in parts.scheme:
            url = html.escape(output)
            safe_link = u'<a href="%s" target="_blank">%s</a>' % (url, url)
            return safestring.mark_safe(safe_link)
    return unicode(output)
dataset/ETHPy150Open CiscoSystems/avos/openstack_dashboard/dashboards/project/stacks/mappings.py/stack_output/swapped operands of `in`