Replaced some try/excepts with checks

Inserted "if ip_name in ip_*:" and replaced "try/excepts"