def headers_to_dict(headers):
    hdrs = {}
    for h, v in headers:
        h = h.lower()
        if h in hdrs:
            if isinstance(hdrs[h], list):
                hdrs[h].append(v)
            else:
                hdrs[h] = [hdrs[h], v]
        else:
            hdrs[h] = v
    return hdrs
Converts a sequence of (name, value) tuples into a dict where if
dataset/ETHPy150Open gholt/swiftly/swiftly/client/utils.py/headers_to_dict