def _raise_bulk_write_error(full_result):
    """Raise a BulkWriteError from the full bulk api result.
    """
    if full_result["writeErrors"]:
        full_result["writeErrors"].sort(
            key=lambda error: error["index"])
    raise BulkWriteError(full_result)
Raise a BulkWriteError from the full bulk api result.
    
stackoverflow/venv/lib/python3.6/site-packages/pymongo/bulk.py