code: def prepare_data(self, data=None):
          '''
          Prepare data for persistency by exporting it to native form
           and making sure we're not persisting with a null primary key.
          '''
          data = data or self.export_data(native=True)
          # make sure we don't persist a null _id and let MongoDB auto-generate it
          if '_id' in data and data['_id'] is None:
              del data['_id']
          return datf prepare_data(self, data=None):
          '''
          Prepare data for persistency by exporting it to native form
           and making sure we're not persisting with a null primary key.
          '''
          data = data or self.export_data(native=True)
          # make sure we don't persist a null _id and let MongoDB auto-generate it
          if '_id' in data and data['_id'] is None:
              del data['_id']
          return data
docs: Prepare data for persistency by exporting it to native form
           and making sure we're not persisting with a null primary key.