wrote lookup_category function