The docstrings says that units is a filter, but you're iterating it like it's an actual set of units. This also may suffer from the same unit ID v. unit key issue above. It'd help to be super clear in the docs as to which you're expecting to avoid confusion.