def _stripslashes(s):
  '''Removes trailing and leading backslashes from string'''
  r = re.sub(r"\\(n|r)", "\n", s)
  r = re.sub(r"\\", "", r)
  return r
Removes trailing and leading backslashes from string