def _bulk_register(watch_states, notifier, cb, details_filter=None):
    """Bulk registers a callback associated with many states."""
    registered = []
    try:
        for state in watch_states:
            if not notifier.is_registered(state, cb,
                                          details_filter=details_filter):
                notifier.register(state, cb,
                                  details_filter=details_filter)
                registered.append((state, cb))
    except __HOLE__:
        with excutils.save_and_reraise_exception():
            _bulk_deregister(notifier, registered,
                             details_filter=details_filter)
    else:
        return registered
dataset/ETHPy150Open openstack/taskflow/taskflow/listeners/base.py/_bulk_register