def gensld_choro_internal(geoname,varname,vartitle,quantiles,unit="number"):
	# WARNING: sld files need to be lower case to be compatible with postgres views
	lvarname = string.lower(varname)
        target_file = '/projects/PublicMapping/DistrictBuilder/sld/pmp:%s_%s.sld' % (geoname,lvarname) 
        varabs="Grayscale choropleth based on quantiles of %s" % (varname)
        valuelist= [
          {"top": str(quantiles[4]),
          "bottom": str(quantiles[3]),
          "fill": "#444444",
          "fillopacity":"1.0",
  	   "unit":unit},
          {"top": str(quantiles[3]),
          "bottom": str(quantiles[2]),
          "fill": "#777777",
          "fillopacity":"1.0",
           "unit":unit},
          {"top": str(quantiles[2]),
          "bottom": str(quantiles[1]),
          "fill": "#AAAAAA",
          "fillopacity":"1.0",
	  "unit":unit},
          {"top": str(quantiles[1]),
          "bottom": str(quantiles[0]),
          "fill": "#EEEEEE",
          "fillopacity":"1.0",
	  "unit":unit}]

   	svaluelist = [{"top": str(quantiles[5]),
          "bottom": str(quantiles[4]),
          "fill": "#000000",
          "fillopacity":"1.0",
	  "unit":unit}]

        f = open(target_file,'w')
        f.write(str( SldList_Template(layername=lvarname,layertitle=vartitle,layerabs=varabs,slst=svaluelist,sli=Sld_URange_Template, lst=valuelist,li=Sld_Range_Template,elst=[{"title":"Boundary","stroke":"#555555","strokewidth":"0.25","strokeopacity":"1.0"}],eli=Sld_Line_Template) ))
	f.write("\n")
        f.close()
        os.chmod(target_file,stat.S_IRUSR|stat.S_IRGRP|stat.S_IROTH)
dataset/ETHPy150Open PublicMapping/DistrictBuilder/docs/loadcensus/configureCensus.py/gensld_choro_internal/original