def user_type_registered(self, keyspace, user_type, klass):
        """
        Called by the parent Cluster instance when the user registers a new
        mapping from a user-defined type to a class.  Intended for internal
        use only.
        """
        try:
            ks_meta = self.cluster.metadata.keyspaces[keyspace]
        except KeyError:
            raise UserTypeDoesNotExist(
                (keyspace,) % 'Keyspace %s does not exist or has not been discovered by the driver')

        try:
            type_meta = ks_meta.user_types[user_type]
        except KeyError:
            raise UserTypeDoesNotExist(
                'User type %s does not exist in keyspace %s' % (user_type, keyspace))

        field_names = type_meta.field_names
        if six.PY2:
            # go from unicode to string to avoid decode errors from implicit
            # decode when formatting non-ascii values
            field_names = [fn.encode('utf-8') for fn in field_names]

        def encode(val):
            return '{ %s }' % ' , '.join('%s : %s' % (
                field_name,
                self.encoder.cql_encode_all_types(getattr(val, field_name, None))
            ) for field_name in field_names)

        self.encoder.mapping[klass] = encode
dataset/ETHPy150Open datastax/python-driver/cassandra/cluster.py/Session.user_type_registered/swapped operands of `%`