'Return the content-transfer-encoding used for body encoding.
This is either the string `quoted-printable\' or `base64\' depending on
the encoding used, or it is a function in which case you should call
the function with a single argument, the Message object being
encoded.  The function should then set the Content-Transfer-Encoding
header itself to whatever is appropriate.
Returns "quoted-printable" if self.body_encoding is QP.
Returns "base64" if self.body_encoding is BASE64.
Returns conversion function otherwise.'

def get_body_encoding(self):

    assert (self.body_encoding != SHORTEST)
    if (self.body_encoding == QP):
        return 'quoted-printable'
    elif (self.body_encoding == BASE64):
        return 'base64'
    else:
        return encode_7or8bit
