Python Check If Array Element Is Not Defined In Jquery Error