SED from Cube code

Made a pull request while I work on this in case you have comments.
Use this instead:
```
if counts is None:
```
(please turn on PEP8 checking in your Eclipse editor ... it will show you this as a warning, so you'll get it right automatically)