<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def getStat(cls, obj, name):
 """Gets the stat for the given object with the given name, or None if no such stat exists."""

    objClass = type(obj)
    for theClass in objClass.__mro__:
      if theClass == object:
        break
      for value in theClass.__dict__.values():
        if isinstance(value, Stat) and value.getName() == name:
          return value