def headers_to_dict(header_lines):
 headers = {}
 headers_list = [x for line in header_lines for x in line.split(': ', 1)]
 headers_dict = dict(zip(headers_list[0::2], headers_list[1::2]))
 for header in headers_dict:
  headers[header.lower()] = headers_dict[header]
 return headers

def headers_to_dict ( header_lines ) : headers = { } headers_list = [ x for line in header_lines for x in line . split ( ': ' , 1 ) ] headers_dict = dict ( zip ( headers_list [ 0 : : 2 ] , headers_list [ 1 : : 2 ] ) ) for header in headers_dict : headers [ header . lower ( ) ] = headers_dict [ header ] return headers
convert the list of header lines into a dictionary .