Simple python version of file_entropy.
Use std::for_each instead of range-based for loop.