Here I think that you should not check whether units are none based on the string representation, but instead check *before* making the string representation whether any units are ``None``. Does this make sense? Also, you could write it more concisely using a list comprehension and the ``all()`` function.