def do_forceescape(value):
 if hasattr(value, '__html__'):
  value = value.__html__()
 return escape(text_type(value))

def do_forceescape ( value ) : if hasattr ( value , '__html__' ) : value = value . __html__ ( ) return escape ( text_type ( value ) )
enforce html escaping .