'Return the length of the encoded header string.'

def encoded_header_len(self, s):

    cset = self.get_output_charset()
    if (self.header_encoding == BASE64):
        return ((email.base64mime.base64_len(s) + len(cset)) + MISC_LEN)
    elif (self.header_encoding == QP):
        return ((email.quoprimime.header_quopri_len(s) + len(cset)) + MISC_LEN)
    elif (self.header_encoding == SHORTEST):
        lenb64 = email.base64mime.base64_len(s)
        lenqp = email.quoprimime.header_quopri_len(s)
        return ((min(lenb64, lenqp) + len(cset)) + MISC_LEN)
    else:
        return len(s)
