WSGI middleware to inject analytics.js in <head/>

Hi.

I implemented a WSGI middleware to inject analytics.js snippet. It is implemented in a non-buffered fashion, so will not delay/swallow the stream, if yielded as chunks.

Before adding a new script, it searches `<head/>` for existing script. If found, it does not inject again. If not found, injects the snippet to `<head/>`. If `<head>` is on same chunk of `</head>` (or the response is not chunked), it injects right after the start of `<head>`.

If closing `</head>` is not on the same chunk as `<head>`, it injects right before `</head>`. Is this recommended/acceptable?

I could buffer `<head>` to `</head>` to be sure, but it delays the stream.
I could simple inject right after `<head>` start, but than I need to keep searching the next chunks for existing snippet, and then chop it if found.

Can I expect it to be merged? Have the original authors some consideration?