code: def pack_buffer(self, key):
          
          self.finish_buffer_write(key)
          file_path = self.items_group_files.get_current_buffer_file_for_group(key).path
          file_hash = None
          if self.hash_algorithm:
              file_hash = hash_for_file(file_path, self.hash_algorithm)
  
          file_size = os.path.getsize(file_path)
          write_info = {
              'number_of_records': self.grouping_info[key]['buffered_items'],
              'file_path': file_path,
              'size': file_size,
              'file_hash': file_hash,
          }
          self.set_metadata_for_file(file_path, **write_info)
          return write_info
docs: Prepare current buffer file for group of given key to be written
          (by gathering statistics).