def parse_headers(header_string):
<EOL>if not header_string:<EOL><INDENT>return list()<EOL><DEDENT>request, headers = header_string.split('<STR_LIT:\r\n>', <NUM_LIT:1>)<EOL>if not headers:<EOL><INDENT>return list()<EOL><DEDENT>if sys.version_info < (<NUM_LIT:2>,<NUM_LIT:7>):<EOL><INDENT>header_msg = message_from_string(headers.encode(HEADER_ENCODING))<EOL>return [(text_type(k.lower(), HEADER_ENCODING), text_type(v, HEADER_ENCODING))<EOL>for k, v in header_msg.items()]<EOL><DEDENT>else:<EOL><INDENT>header_msg = message_from_string(headers)<EOL>return [(k.lower(), v) for k, v in header_msg.items()]<EOL><DEDENT>
Parse a header-string into individual headers
        Implementation based on: http://stackoverflow.com/a/5955949/95122
        Note that headers are a list of (key, value) since duplicate headers are allowed

        NEW NOTE: keys & values are unicode strings, but can only contain ISO-8859-1 characters