def formatFailure(myFailure):
 result = []
 flattenString(None, FailureElement(myFailure)).addBoth(result.append)
 if isinstance(result[0], bytes):
  return result[0].decode('utf-8').encode('ascii', 'xmlcharrefreplace')
 result[0].raiseException()

def formatFailure ( myFailure ) : result = [ ] flattenString ( None , FailureElement ( myFailure ) ) . addBoth ( result . append ) if isinstance ( result [ 0 ] , bytes ) : return result [ 0 ] . decode ( 'utf-8' ) . encode ( 'ascii' , 'xmlcharrefreplace' ) result [ 0 ] . raiseException ( )
construct an html representation of the given failure .