Converts from camelCase to snake_case e.g.: camelCase => camel_case
copy pasted from https://gist.github.com/sidharthkuruvila/3154845#gistcomment-2622928