Nitpick:  ```if key not in occurrence_count ...``` is easier to parse than ```if not key in occurrence_count ...``` (and more idiomatic I think)