def to_yaml(self, str_or_buffer=None):
        logger.debug('serializing LCM model {} to YAML'.format(self.name))
        if (not isinstance(self.probability_mode, str) or
                not isinstance(self.choice_mode, str)):
            raise TypeError(
                'Cannot serialize model with non-string probability_mode '
                'or choice_mode attributes.')
        return yamlio.convert_to_yaml(self.to_dict(), str_or_buffer)
Test more esoteric (but necessary) features
dataset/ETHPy150Open UDST/urbansim/urbansim/models/dcm.py/MNLDiscreteChoiceModel.to_yaml--crossover with--dataset/ETHPy150Open sassoftware/conary/conary_test/cvctest/buildtest/testcomptest.py/TestCompTest.testCompTestAdvancedTests