def _chk_type(recdef, rec):
        """Checks if type of `rec` matches `recdef`
        :param recdef: instance of RecordDef
        :param rec:    instance of Record
        :raises:       `TypeError`
        """
        if len(recdef) != len(rec):
            raise TypeError("Number of columns (%d) is different from RecordDef (%d)" % (len(rec), len(recdef)))

        for i in xrange(len(recdef)):
            try:
                def_type = recdef[i].type
                col_type = Type.equivalent_relshell_type(rec[i])
                if col_type != def_type:
                    raise TypeError("Column %d has mismatched type:  Got '%s' [%s] ; Expected [%s]" %
                                    (i, rec[i], col_type, def_type))
            except AttributeError as e:
                # recdef[i].type is not defined, then any relshell type is allowed
                try:
                    Type.equivalent_relshell_type(rec[i])
                except NotImplementedError as e:
                    raise TypeError("%s" % (e))
def _chk_type ( recdef , rec ) : if len ( recdef ) != len ( rec ) : raise TypeError ( "Number of columns (%d) is different from RecordDef (%d)" % ( len ( rec ) , len ( recdef ) ) ) for i in xrange ( len ( recdef ) ) : try : def_type = recdef [ i ] . type col_type = Type . equivalent_relshell_type ( rec [ i ] ) if col_type != def_type : raise TypeError ( "Column %d has mismatched type:  Got '%s' [%s] ; Expected [%s]" % ( i , rec [ i ] , col_type , def_type ) ) except AttributeError as e : try : Type . equivalent_relshell_type ( rec [ i ] ) except NotImplementedError as e : raise TypeError ( "%s" % ( e ) )
Checks if type of `rec` matches `recdef`
        :param recdef: instance of RecordDef
        :param rec:    instance of Record
        :raises:       `TypeError`