<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _setFlag(self, name, val, defVal):
 """set the objects property propName if the dictKey key exists in dict and it is not the same as default value defVal"""

        if not hasattr(self, "flags"):
            self.flags = {}
        if val != defVal:
            self.flags[name] = val