<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def validate_event_type(sender, event, created):
 """Verify that the Event's code is a valid one."""

    if event.code not in sender.event_codes():
        raise ValueError("The Event.code '{}' is not a valid Event "
                         "code.".format(event.code))