changed cost.py to conform to pep8

Fixed costs/cost.py as a part of #821
This file is at a second place in test_format.py. Remove it at that second place. Maybe this will cause tests in this file to fail. If so, also fix them.