<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def getAggregator(cls, instanceId, name):
 """Gets the aggregate stat for the given stat."""

    parent = cls.parentMap.get(instanceId)
    while parent:
      stat = cls.getStat(parent, name)
      if stat:
        return stat, parent
      parent = cls.parentMap.get(statsId(parent))