def serialize(self):
import datetime<EOL>items = []<EOL>time_begin = datetime.datetime.now()<EOL>for href in self.list():<EOL><INDENT>items.append(self.get(href).item)<EOL><DEDENT>time_end = datetime.datetime.now()<EOL>self.logger.info(<EOL>"<STR_LIT>", len(items),<EOL>(time_end - time_begin).total_seconds(), self.path)<EOL>if self.get_meta("<STR_LIT>") == "<STR_LIT>":<EOL><INDENT>collection = vobject.iCalendar()<EOL>for item in items:<EOL><INDENT>for content in ("<STR_LIT>", "<STR_LIT>", "<STR_LIT>"):<EOL><INDENT>if content in item.contents:<EOL><INDENT>for item_part in getattr(item, "<STR_LIT>" % content):<EOL><INDENT>collection.add(item_part)<EOL><DEDENT>break<EOL><DEDENT><DEDENT><DEDENT>return collection.serialize()<EOL><DEDENT>elif self.get_meta("<STR_LIT>") == "<STR_LIT>":<EOL><INDENT>return "<STR_LIT>".join([item.serialize() for item in items])<EOL><DEDENT>return "<STR_LIT>"<EOL>
Get the unicode string representing the whole collection.