def cleanse(self):
from .util import slugify<EOL>self.ensure_identifier()<EOL>try:<EOL><INDENT>self.update_name()<EOL><DEDENT>except MetatabError:<EOL><INDENT>identifier = self['<STR_LIT>'].find_first('<STR_LIT>')<EOL>name = self['<STR_LIT>'].find_first('<STR_LIT>')<EOL>if name and name.value:<EOL><INDENT>name.value = slugify(name.value)<EOL><DEDENT>elif name:<EOL><INDENT>name.value = slugify(identifier.value)<EOL><DEDENT>else:<EOL><INDENT>self['<STR_LIT>'].get_or_new_term('<STR_LIT>').value = slugify(identifier.value)<EOL><DEDENT><DEDENT>
Clean up some terms, like ensuring that the name is a slug