Why the trailing space? There's a bit of duplication here, it would be nice to optimise this with a loop over the various targets, a dict could store the name, type, and codename. This can be a later enhancement though.