import re

def getPlacemark(name, desc, lat, lng):
	'''string * string * float * float -> string'''

	template = '''<Placemark>
     <name>NAME_HERE</name>
     <description>DESC_HERE</description>
     <Style>
       <IconStyle>
         <scale>1.2</scale>
         <Icon>
           <href>http://maps.google.com/mapfiles/kml/pushpin/wht-pushpin.png</href>
         </Icon>
         <color>ffff0000</color>
       </IconStyle>
     </Style>
     <Point>
       <coordinates>LNG_HERE,LAT_HERE,0</coordinates>
     </Point>
</Placemark>'''

	# USE re.sub to make the replacements below
	temp1 = re.sub("NAME_HERE", name, template); #This replaces NAME_HERE with whatever string name is.
	temp2 = re.sub("FILL THE REST OF THESE IN", variable, temp1) #replace description with desc
	temp3 = # create temporary string replacing the longitude stub with the longitude; use str(lng) to convert from float to string
	temp4 = # create temporary string replacing the latitude stub with the latitude; use str(lat) to convert from float to string

	return temp4

def getKML(mainList):
	'''list([string, float, float]) -> string'''

	kmlString = "Beginning of KML document"

	for subList in mainList: #add each placemark's string to kmlstring to generate a file with every placemark
		# desc is at position 0 of the current sublist
		# latitude is at position 1 of the current sublist
		# longitude is at position 2 of the current sublist

		# get the corresponding placemark; use "tweet" as the "name" parameter
		# append that placemark into KML string

	kmlString = kmlString + "end of KML document" # append something to the end of the KML string

	return kmlString


#define one last function to take in a kml document string and create a .kml file that contains the inputted string.



test_data = [["Here is a tweet", -15.7939, -47.8828],
	     ["here is another tweet!", 41.8236, -71.422],
	     ["Miles doesn't use twitter much, so he doesn't know what to write in them #hashtag ##.", 0, 0]]
