def validate_type(magic_kind):
 if (magic_kind not in magic_spec):
  raise ValueError(('magic_kind must be one of %s, %s given' % magic_kinds), magic_kind)

def validate_type ( magic_kind ) : if ( magic_kind not in magic_spec ) : raise ValueError ( ( 'magic_kind must be one of %s, %s given' % magic_kinds ) , magic_kind )
ensure that the given magic_kind is valid .