So I have quite the hierarchy of groups containing over 2500 sensors in total. Through the API I have managed to get info regarding each of these sensors but the only thing I'm missing is that I'd like to know the name of a sensors parent's parent. Right now I have i.e. a sensor of type ping. The ping sensor's parent is a group of a specific name which in this case is the name of a school. In that group there are other sensors specific to that school as well. So on average there are maybe a 5-10 sensors per school and maybe 20-30 schools per brand (said parent group). Now I would like to know how I get the name of the parent group of a sensors parent group. Below is kind of an example of what I'm trying to achieve in which case I'm trying to get the name of the School Brand A group.
 - School Brand A (group)
 - School A (group)
 - Sensor 1 (sensor)  - Sensor 2 (sensor)  - School B (group)
 - Sensor 1 (sensor)  - Sensor 2 (sensor)
Thank you in advance