def h2_safe_headers(headers):
    stripped = {
        i.lower().strip()
        for k, v in headers if k == 'connection'
        for i in v.split(',')
    }
    stripped.add('connection')

    return [header for header in headers if header[0] not in stripped]
This method takes a set of headers that are provided by the user and
dataset/ETHPy150Open Lukasa/hyper/hyper/http20/util.py/h2_safe_headers