Let's not parse headers on our own. Headers are standardized very well and handled very well by Python's standard libraries. One example on how to do header parsing is like so (I haven't tested this on Python 3):

```python
from email.parser import HeaderParser

h = HeaderParser()
message = h.parsestr('Content-Type: multipart/form-data; boundary=f0barb0gus\r\nX-Custom-Header: some-value')
message.items()  # => [('Content-Type', 'multipart/form-data; boundar=f0barb0gus'), ('X-Custom-Header', 'some-value')]
```