code: def _compile_set(self, schema):
          
          type_ = type(schema)
          type_name = type_.__name__
  
          def validate_set(path, data):
              if not isinstance(data, type_):
                  raise er.Invalid('expected a %s' % type_name, path)
  
              _compiled = [self._compile(s) for s in schema]
              errors = []
              for value in data:
                  for validate in _compiled:
                      try:
                          validate(path, value)
                          break
                      except er.Invalid:
                          pass
                  else:
                      invalid = er.Invalid('invalid value in %s' % type_name, path)
                      errors.append(invalid)
  
              if errors:
                  raise er.MultipleInvalid(errors)
  
              return data
  
          return validate_set
docs: Validate a set.
  
          A set is an unordered collection of unique elements.
  
          >>> validator = Schema({int})
          >>> validator(set([42])) == set([42])
          True
          >>> with raises(er.Invalid, 'expected a set'):
          ...   validator(42)
          >>> with raises(er.MultipleInvalid, 'invalid value in set'):
          ...   validator(set(['a']))