def _is_bulk_item_ok(item):
    # this becomes messier if we're supporting pre-1.0 ElasticSearch
    # alongside 1.0 ones.

    operations = ("create", "index", "delete", "update")

    for op in operations:
        try:
            if 'ok' in item[op]:
                return True
            elif 'status' in item[op]:
                return item[op]['status'] in [200, 201]
            else:
                return False
        except KeyError:
            continue

    # unknown response type; be conservative
    return False
dataset/ETHPy150Open aparo/pyes/pyes/models.py/_is_bulk_item_ok/original