'Converts the content, mimetype pair into a MIME attachment object.'

def _create_mime_attachment(self, content, mimetype):

    (basetype, subtype) = mimetype.split(u'/', 1)
    if (basetype == u'text'):
        encoding = (self.encoding or settings.DEFAULT_CHARSET)
        attachment = SafeMIMEText(content, subtype, encoding)
    else:
        attachment = MIMEBase(basetype, subtype)
        attachment.set_payload(content)
        Encoders.encode_base64(attachment)
    return attachment
