'Retrieve the size of a message, or, if none is specified, the size of
each message in the mailbox.
@type i: L{int} or L{None}
@param i: The 0-based index of a message.
@rtype: L{int} or L{list} of L{int}
@return: The number of octets in the specified message, or, if an index
is not specified, a list of the number of octets in each message in
the mailbox.  Any value which corresponds to a deleted message is
set to 0.
@raise IndexError: When the index does not correspond to a message in
the mailbox.'

def listMessages(self, i=None):

    if (i is None):
        return [self.listMessages(msg) for msg in range(len(self.msgs))]
    if (i in self._delete):
        return 0
    return len(self.msgs[i])
