code: def validate_event_type(sender, event, created):
      
      if event.code not in sender.event_codes():
          raise ValueError("The Event.code '{}' is not a valid Event "
                           "code.".format(event.code))
docs: Verify that the Event's code is a valid one.