class_docstr: Basic message object.
  
  A message object is defined as something that has a bunch of RFC 2822
  headers and a payload.  It may optionally have an envelope header
  (a.k.a. Unix-From or From_ header).  If the message is a container (i.e. a
  multipart or a message/rfc822), then the payload is a list of Message
  objects, otherwise it is a string.
  
  Message objects implement part of the `mapping' interface, which assumes
  there is exactly one occurrence of the header per message.  Some headers
  do in fact appear multiple times (e.g. Received) and for those headers,
  you must use the explicit API to set or get all the headers.  Not all of
  the mapping methods are implemented.
docstr: Set the main type and subtype for the Content-Type header.
  
  type must be a string in the form "maintype/subtype", otherwise a
  ValueError is raised.
  
  This method replaces the Content-Type header, keeping all the
  parameters in place.  If requote is False, this leaves the existing
  header's quoting as is.  Otherwise, the parameters will be quoted (the
  default).
  
  An alternative header can be specified in the header argument.  When
  the Content-Type header is set, we'll always also add a MIME-Version
  header.
docstr_tok: ["Set","the","main","type","and","subtype","for","the","Content-Type","header",".","type","must","be","a","string","in","the","form","``","maintype\/subtype","''",",","otherwise","a","ValueError","is","raised",".","This","method","replaces","the","Content-Type","header",",","keeping","all","the","parameters","in","place",".","If","requote","is","False",",","this","leaves","the","existing","header","'s","quoting","as","is",".","Otherwise",",","the","parameters","will","be","quoted","(","the","default",")",".","An","alternative","header","can","be","specified","in","the","header","argument",".","When","the","Content-Type","header","is","set",",","we","'ll","always","also","add","a","MIME-Version","header","."]
code: def set_type(self, type, header="Content-Type", requote=True):
      """Set the main type and subtype for the Content-Type header.
  
      type must be a string in the form "maintype/subtype", otherwise a
      ValueError is raised.
  
      This method replaces the Content-Type header, keeping all the
      parameters in place.  If requote is False, this leaves the existing
      header's quoting as is.  Otherwise, the parameters will be quoted (the
      default).
  
      An alternative header can be specified in the header argument.  When
      the Content-Type header is set, we'll always also add a MIME-Version
      header.
      """
      # BAW: should we be strict?
      if not type.count("/") == 1:
          raise ValueError
      # Set the Content-Type, you get a MIME-Version
      if header.lower() == "content-type":
          del self["mime-version"]
          self["MIME-Version"] = "1.0"
      if header not in self:
          self[header] = type
          return
      params = self.get_params(header=header, unquote=requote)
      del self[header]
      self[header] = type
      # Skip the first param; it's the old type.
      for p, v in params[1:]:
          self.set_param(p, v, header, requote)
  
imports: import re
  import uu
  import binascii
  import warnings
  from cStringIO import StringIO
  import email.charset
  from email import utils
  from email import errors
label_desc: Use image node_id 35 for calling the Message obj's underlying member method code with example usage: obj.set_type(type, header, requote) without return types