<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def tokml(self):
 """Generate a KML Placemark element subtree. Returns: etree.Element: KML Placemark element """

        placemark = create_elem('Placemark')
        if self.name:
            placemark.set('id', self.name)
            placemark.name = create_elem('name', text=self.name)
        if self.description:
            placemark.description = create_elem('description',
                                                text=self.description)
        placemark.Point = create_elem('Point')

        data = [str(self.longitude), str(self.latitude)]
        if self.altitude:
            if int(self.altitude) == self.altitude:
                data.append('%i' % self.altitude)
            else:
                data.append(str(self.altitude))
        placemark.Point.coordinates = create_elem('coordinates',
                                                  text=','.join(data))

        return placemark