<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def com_google_fonts_check_ttx_roundtrip(font):
 """Checking with fontTools.ttx"""

  from fontTools import ttx
  import sys
  ttFont = ttx.TTFont(font)
  failed = False

  class TTXLogger:
    msgs = []

    def __init__(self):
      self.original_stderr = sys.stderr
      self.original_stdout = sys.stdout
      sys.stderr = self
      sys.stdout = self

    def write(self, data):
      if data not in self.msgs:
        self.msgs.append(data)

    def restore(self):
      sys.stderr = self.original_stderr
      sys.stdout = self.original_stdout

  from xml.parsers.expat import ExpatError
  try:
    logger = TTXLogger()
    xml_file = font + ".xml"
    ttFont.saveXML(xml_file)
    export_error_msgs = logger.msgs

    if len(export_error_msgs):
      failed = True
      yield INFO, ("While converting TTF into an XML file,"
                   " ttx emited the messages listed below.")
      for msg in export_error_msgs:
        yield FAIL, msg.strip()

    f = ttx.TTFont()
    f.importXML(font + ".xml")
    import_error_msgs = [msg for msg in logger.msgs if msg not in export_error_msgs]

    if len(import_error_msgs):
      failed = True
      yield INFO, ("While importing an XML file and converting"
                   " it back to TTF, ttx emited the messages"
                   " listed below.")
      for msg in import_error_msgs:
        yield FAIL, msg.strip()
    logger.restore()
  except ExpatError as e:
    failed = True
    yield FAIL, ("TTX had some problem parsing the generated XML file."
                 " This most likely mean there's some problem in the font."
		 " Please inspect the output of ttx in order to find more"
		 " on what went wrong. A common problem is the presence of"
                 " control characteres outside the accepted character range"
                 " as defined in the XML spec. FontTools has got a bug which"
                 " causes TTX to generate corrupt XML files in those cases."
                 " So, check the entries of the name table and remove any"
                 " control chars that you find there."
		 " The full ttx error message was:\n"
		 "======\n{}\n======".format(e))

  if not failed:
    yield PASS, "Hey! It all looks good!"

  # and then we need to cleanup our mess...
  if os.path.exists(xml_file):
    os.remove(xml_file)