This is only used in one place after which we use `encode_with`. This should be rewritten as a separate function (not attached to the class) to use that instead like so:

```python
def _header_parser(string, encoding):
    major = sys.version_info[0]
    if major == 3:
        string = string.decode(encoding)
    headers = email.parser.HeaderParser().parsestr(string).items()
    return (encode_with(k, encoding), encode_with(v, encoding) for (k, v) in headers)
```

This simplifies the usage below to:

```python
self.headers = CaseInsensitiveDict(_header_parser(first.lstrip(), self.encoding))
```