def conditional_escape(text):
 if isinstance(text, SafeData):
  return text
 else:
  return escape(text)

def conditional_escape ( text ) : if isinstance ( text , SafeData ) : return text else : return escape ( text )
similar to escape() .