docs: def pickle_dict(items):
      '''Returns a new dictionary where values which aren't instances of
      basestring are pickled. Also, a new key '_pickled' contains a comma
      separated list of keys corresponding to the pickled values.
      '''
      ret = {}
      pickled_keys = []
      for key, val in items.items():
          if isinstance(val, basestring):
              ret[key] = val
          else:
              pickled_keys.append(key)
              ret[key] = pickle.dumps(val)
      if pickled_keys:
          ret['_pickled'] = ','.join(pickled_keys)
      return ret