def check_constraint(column, lenum, **kwargs):
        """
        Returns a SQL CHECK constraint string given a column name and a
        :class:`~coaster.utils.classes.LabeledEnum`.

        Alembic may not detect the CHECK constraint when autogenerating
        migrations, so you may need to do this manually using the Python
        console to extract the SQL string::

            from coaster.sqlalchemy import StateManager
            from your_app.models import YOUR_ENUM

            print str(StateManager.check_constraint('your_column', YOUR_ENUM).sqltext)

        :param str column: Column name
        :param LabeledEnum lenum: :class:`~coaster.utils.classes.LabeledEnum` to retrieve valid values from
        :param kwargs: Additional options passed to CheckConstraint
        """
        return CheckConstraint(
            str(column_constructor(column).in_(lenum.keys()).compile(compile_kwargs={'literal_binds': True})),
            **kwargs)