After thinking about the flattening list discussion I found a library called pydash which is a functional programming library for python or if you are familiar with lodash its like lodash but for python. See https://github.com/dgilland/pydash and http://pydash.readthedocs.org/en/latest/#