This python script was used to create a tool in ArcGIS which takes a shapefile and converts it to geojson format for use in leaflet.js web map applications. The script itself creates a .json output for using with services such as CartoDB and also creates a .js file with a single variable storing geoJson. The .js file could then be linked to your project and the variable used directly in your map for simple projects that don't require a database.
This python script was used to create a tool in ArcGIS which takes a file containing a Python dictionary, with keys representing a field attribute and values representing a 6-digit hex code for CSS styling, and creates a new field named HEX that stores the hex values in the shapefile. Hex values are useless in ArcMap but by adding them to the shapefile before converting to GeoJSON, they will then be stored as a fetaure property that can be used for setting the proper style in Leaflet.JS.