<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def check(self, defn):
 """Performs isinstance check for the definitions data type. Assumes the defn has 'type' and 'name' attributes """

        allowedTypes = dtype.PrimitiveType, dtype.ArrayType
        if not isinstance(defn.type, allowedTypes):
            self.messages.append(self.msg % str(defn.name))
            # self.messages.append("TBD location message")
            self.valid = False