def _translate_failures(func):
    """Translates common requests exceptions into tooz exceptions."""

    @six.wraps(func)
    def wrapper(*args, **kwargs):
        try:
            return func(*args, **kwargs)
        except __HOLE__ as e:
            # Typically json decoding failed for some reason.
            coordination.raise_with_cause(coordination.ToozError,
                                          encodeutils.exception_to_unicode(e),
                                          cause=e)
        except requests.exceptions.RequestException as e:
            coordination.raise_with_cause(coordination.ToozConnectionError,
                                          encodeutils.exception_to_unicode(e),
                                          cause=e)

    return wrapper
dataset/ETHPy150Open openstack/tooz/tooz/drivers/etcd.py/_translate_failures