This line is just a mess and should probably be broken up into a few lines :)

Also comparison with `None` should just be written (in this case) `if self[x].unit is None`.