code: def set_header_dict(response, header, header_dict):
      
      def dictvalue(t):
          if t[1] is True:
              return t[0]
          return t[0] + '=' + smart_str(t[1])
  
      response[header] = ', '.join([dictvalue(el) for el in header_dict.items()])
docs: Formats and sets a header dict in a response, inververs of get_header_dict.