def _use_html_if_available(format_fn):
        """Use the value's HTML rendering if available, overriding format_fn."""
        def format_using_as_html(v, label=False):
            if not label and hasattr(v, 'as_html'):
                return v.as_html()
            else:
                return format_fn(v, label)
        return format_using_as_html
def _use_html_if_available ( format_fn ) : def format_using_as_html ( v , label = False ) : if not label and hasattr ( v , 'as_html' ) : return v . as_html ( ) else : return format_fn ( v , label ) return format_using_as_html
Use the value's HTML rendering if available, overriding format_fn.