Use chain() from itertools for better efficiency and nicer code, improve map read