'Send a GET request and convert errors to exceptions'

def _do_get(self, uri):

    try:
        req = urllib2.Request(uri)
        req.add_header('Accept', 'application/json')
        r = urllib2.urlopen(req)
        resp = json.load(r)
        if ('Error' in resp):
            raise ZooKeeper.Error(resp['Error'])
        return resp
    except urllib2.HTTPError as e:
        if (e.code == 404):
            raise ZooKeeper.NotFound(uri)
        raise
