'Normalize and hash a message ID for the metadata index'

def _encode_msg_id(self, msg_id):

    if ('<' in msg_id):
        new_msg_id = ('<%s>' % msg_id.split('<')[1].split('>')[0])
        if (len(new_msg_id) > 2):
            msg_id = new_msg_id
    return b64c(sha1b64(msg_id.strip()))
