code: def diff(s1, s2):
      ''' --word-diff=porcelain clone'''
      delta = difflib.Differ().compare(s1.split(), s2.split())
      difflist = []
      fullline = ''
      for line in delta:
          if line[0] == '?':
              continue
          elif line[0] == ' ':
              fullline += line.strip() + ' '
          else:
              if fullline:
                  difflist.append(fullline[:-1])
                  fullline = ''
              difflist.append(line)
      if fullline:
          difflist.append(fullline[:-1])
      return [l[:] for l in '\n'.join(difflist).splitlines() if lf diff(s1, s2):
      ''' --word-diff=porcelain clone'''
      delta = difflib.Differ().compare(s1.split(), s2.split())
      difflist = []
      fullline = ''
      for line in delta:
          if line[0] == '?':
              continue
          elif line[0] == ' ':
              fullline += line.strip() + ' '
          else:
              if fullline:
                  difflist.append(fullline[:-1])
                  fullline = ''
              difflist.append(line)
      if fullline:
          difflist.append(fullline[:-1])
      return [l[:] for l in '\n'.join(difflist).splitlines() if l]
docs: --word-diff=porcelain clone