code: def fix_whitespace(line, offset, replacement):
      
      # Replace escaped newlines too
      left = line[:offset].rstrip('\n\r \t\\')
      right = line[offset:].lstrip('\n\r \t\\')
      if right.startswith('#'):
          return line
      else:
          return left + replacement + right
docs: Replace whitespace at offset and return fixed line.