take diff of a to b, apply to a, return the applied diff so external code can check it against b

def checkdiff(a,b,sp=True):
  'take diff of a to b, apply to a, return the applied diff so external code can check it against b'
  if sp: a=splitpreserve(a); b=splitpreserve(b)
  res=applydiff(a,rediff(a,b))
  if sp: res=''.join(res)
  return res