Function Is Not Subscriptable Python