all of cobra core passes pep8

This is mostly whitespace and other small chagnes, such as rearranging
unnecessary list comprehensions to loops.