def callback(
        map=None,
        is_200=False,
        is_json=False,
        index=False,
        one=False,
        allow_404=True):

    def cb(response):
        if response.code >= 500 and response.code < 600:
            raise ConsulException("%d %s" % (response.code, response.body))
        if response.code == 403:
            raise ACLPermissionDenied(response.body)
        if response.code == 404 and not allow_404:
            raise NotFound(response.body)
        if is_200:
            data = response.code == 200
        elif is_json:
            data = json.loads(response.body)
        else:
            data = response
        if one:
            if data == []:
                data = None
            if data is not None:
                data = data[0]
        if map:
            data = map(data)
        if index:
            return response.headers['X-Consul-Index'], data
        return data
    return cb
dataset/ETHPy150Open cablehead/python-consul/consul/base.py/callback/original