def typeCheck(self, fieldDefs=None, filterUnknown=False):
        """
        Check values of fields according to the field definition.

        This method walks all named fields to check their values against their
        type, and is typically used for forms received from other entities. The
        field definition in C{fieldDefs} is used to check the field type.

        If C{filterUnknown} is C{True}, fields that are not present in
        C{fieldDefs} are removed from the form.

        If the field type is C{None} (when not set by the sending entity),
        the type from the field definitition is used, or C{'text-single'} if
        that is not set.

        If C{fieldDefs} is None, an empty dictionary is assumed. This is
        useful for coercing boolean and JID values on forms with type
        C{'form'}.

        @param fieldDefs: Field definitions as a dictionary. See
            L{wokkel.iwokkel.IPubSubService.getConfigurationOptions}
        @type fieldDefs: C{dict}

        @param filterUnknown: If C{True}, remove fields that are not in
            C{fieldDefs}.
        @type filterUnknown: C{bool}
        """

        if fieldDefs is None:
            fieldDefs = {}

        filtered = []

        for name, field in self.fields.iteritems():
            if name in fieldDefs:
                fieldDef = fieldDefs[name]
                if 'type' not in fieldDef:
                    fieldDef['type'] = 'text-single'

                if field.fieldType is None:
                    field.fieldType = fieldDef['type']
                elif field.fieldType != fieldDef['type']:
                    raise TypeError("Field type for %r is %r, expected %r" %
                                    (name,
                                     field.fieldType,
                                     fieldDef['type']))
                else:
                    # Field type is correct
                    pass
                field.typeCheck()
            elif filterUnknown:
                filtered.append(field)
            elif field.fieldType is not None:
                field.typeCheck()
            else:
                # Unknown field without type, no checking, no filtering
                pass

        for field in filtered:
            self.removeField(field)
dataset/ETHPy150Open ralphm/wokkel/wokkel/data_form.py/Form.typeCheck/original