def replace_header(headers, name, value):
    name = name.lower()
    i = 0
    result = None
    while i < len(headers):
        if headers[i][0].lower() == name:
            assert not result, "two values for the header '%s' found" % name
            result = headers[i][1]
            headers[i] = (name, value)
        i += 1
    if not result:
        headers.append((name, value))
    return result


############################################################
## Deprecated methods
############################################################
Updates the headers replacing the first occurance of the given name
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/Paste-2.0.1/paste/response.py/replace_header