rewrite _expand_counts

Now more numpythonic. Thanks for the suggestion @wasade
add Raises section to lladser docstring

Also rename globals to start with underscores.