def valid_for(whitelist):
def decorator(func):<EOL><INDENT>@functools.wraps(func)<EOL>def wrapper(self, *args):<EOL><INDENT>valid_item = False<EOL>try:<EOL><INDENT>if Id(self.my_osid_object_form._my_map['<STR_LIT>']).identifier in whitelist:<EOL><INDENT>valid_item = True<EOL><DEDENT><DEDENT>except AttributeError:<EOL><INDENT>if Id(self.my_osid_object._my_map['<STR_LIT>']).identifier in whitelist:<EOL><INDENT>valid_item = True<EOL><DEDENT><DEDENT>finally:<EOL><INDENT>if valid_item:<EOL><INDENT>return func(self, *args)<EOL><DEDENT>else:<EOL><INDENT>raise IllegalState('<STR_LIT>')<EOL><DEDENT><DEDENT><DEDENT>return wrapper<EOL><DEDENT>return decorator<EOL>
descriptor to check the genus type of an item, to see
    if the method is valid for that type
    From http://stackoverflow.com/questions/30809814/python-descriptors-with-arguments
    :param whitelist: list of OLX tag names, like 'chapter' or 'vertical'
    :return: