Generate vevent from given event

def _gen_vevent(self, event, vevent):
        """Generate vevent from given event"""
        vevent.add('dtstart').value = event['dtstart'][0]
        vevent.add('dtstamp').value = datetime.fromtimestamp(self._mtime)
        vevent.add('summary').value = event['msg']
        vevent.add('uid').value = event['uid']

        if 'class' in event:
            vevent.add('class').value = event['class']

        if 'categories' in event and len(event['categories']) > 0:
            vevent.add('categories').value = event['categories']

        if 'location' in event:
            vevent.add('location').value = event['location']

        if 'description' in event:
            vevent.add('description').value = event['description']

        if isinstance(event['dtstart'][0], datetime):
            if self._alarm != timedelta():
                valarm = vevent.add('valarm')
                valarm.add('trigger').value = self._alarm
                valarm.add('action').value = 'DISPLAY'
                valarm.add('description').value = event['msg']

            if 'duration' in event:
                vevent.add('duration').value = event['duration']
            else:
                vevent.add('dtend').value = event['dtstart'][0]

        elif len(event['dtstart']) == 1:
            vevent.add('dtend').value = event['dtstart'][0] + timedelta(days=1)

        if len(event['dtstart']) > 1:
            Remind._gen_dtend_rrule(event['dtstart'], vevent)