Log processor in python