code: def read_headers(rfile, hdict=None):
      if hdict is None:
          hdict = {}
      while True:
          line = rfile.readline()
          if not line:
              raise ValueError("Illegal end of headers.")
          if line == CRLF:
              break
          if not line.endswith(CRLF):
              raise ValueError("HTTP requires CRLF terminators")
          if line[0] in ' \t':
              v = line.strip()
          else:
              try:
                  k, v = line.split(":", 1)
              except ValueError:
                  raise ValueError("Illegal header line.")
              k = k.strip().title()
              v = v.strip()
              hname = k
          if k in comma_separated_headers:
              existing = hdict.get(hname)
              if existing:
                  v = ", ".join((existing, v))
          hdict[hname] = v
      return hdict