code: def _format_line(self, side, flag, linenum, text):
          
          try:
              linenum = '%d' % linenum
              id = ' id="%s%s"' % (self._prefix[side], linenum)
          except TypeError:
              # handle blank lines where linenum is '>' or ''
              id = ''
          # replace those things that would get confused with HTML symbols
          text = text.replace("&", "&amp;"). \
              replace(">", "&gt;"). \
              replace("<", "&lt;")
  
          # make space non-breakable so they don't get compressed or line wrapped
          text = text.replace(' ', '&nbsp;').rstrip()
  
          color = ''
          if '\0^' in text or '\0+' in text or '\0-' in text:
              color = ';background-color:{0}'
              if side == 0:
                  color = color.format('#ffe6e6')
              else:
                  color = color.format('#e3ffe3')
          return self.TD_DIFF_HEADER.format(id, linenum, color, text)
docs: Returns HTML markup of "from" / "to" text lines
  
          side -- 0 or 1 indicating "from" or "to" text
          flag -- indicates if difference on line
          linenum -- line number (used for line number column)
          text -- line text to be marked up