This check is unnecessary here because this same condition is checked by `valid_codename` in the calling function. I would remove it, but add a comment like "assuming loc exists because we already determined codename is valid". Or you could re-use `valid_codename` here.