a) You don't need to check `NoneType` at the end, because you check `None` at the beginning.
b) Can we just make sure that `definition_locators` are never `None`?