code: def _raise_bulk_write_error(full_result):
      
      if full_result["writeErrors"]:
          full_result["writeErrors"].sort(
              key=lambda error: error["index"])
      raise BulkWriteError(full_result)
docs: Raise a BulkWriteError from the full bulk api result.