old_contents: #! /usr/bin/python2
  # vim: set fileencoding=utf-8
  
  
  def save_var(filename, d):
      import cPickle
      with open(filename, 'w') as f:
          pck = cPickle.Pickler(f)
          pck.dump(d)
  
  
  def load_var(filename):
      import cPickle
      with open(filename) as f:
          pck = cPickle.Unpickler(f)
          d = pck.load()
      return d
  
new_contents: #! /usr/bin/python2
  # vim: set fileencoding=utf-8
  import pickle
  
  
  def save_var(filename, d):
      with open(filename, 'wb') as f:
          pickle.dump(d, f, 2)
  
  
  def load_var(filename):
      try:
          with open(filename, 'rb') as f:
              d = pickle.load(f)
      except IOError:
          raise
      return d
  
subject: use pickle and throw exception if file doesn't exist.