<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def generate_enum(self):
 """ Means that only value specified in the enum is valid. .. code-block:: python { 'enum': ['a', 'b'], } """

        enum = self._definition['enum']
        if not isinstance(enum, (list, tuple)):
            raise JsonSchemaDefinitionException('enum must be an array')
        with self.l('if {variable} not in {enum}:'):
            enum = str(enum).replace('"', '\\"')
            self.l('raise JsonSchemaException("{name} must be one of {}")', enum)