old_contents: class OneOf:
  	def __init__(self, members):
  		self.members = members
  
  	def __call__(self, candidate):
  		if candidate in self.members:
  			return True
  		return "%s not in %s" % (candidate, self.members)
  
  	def __repr__(self):
  		return "one of %s" % ', '.join(map(repr, self.members))
  
  def oneof(*members):
  	return OneOf(members)
  
  class InRange:
  	def __init__(self, start, end):
  		self.start = start
  		self.end = end
  
  	def __call__(self, candidate):
  		if self.start <= candidate <= self.end:
  			return True
  		return "%s not between %s and %s" % (candidate, self.start, self.end)
  
  	def __repr__(self):
  		return "between %s and %s" % (self.start, self.end)
  
  def inrange(start, end):
  	return InRange(start, end)
  
new_contents: class Predicate:
  	def __init__(self, fn, desc, onFail = None):
  		self.fn = fn
  		self.desc = desc
  		self.onFail = onFail
  
  	def __call__(self, *args, **kw):
  		rtn = self.fn(*args, **kw)
  		if rtn is False and self.onFail:
  			rtn = self.onFail(*args, **kw)
  		return rtn
  
  	def __repr__(self):
  		return self.desc
  
  def oneof(*members):
  	return Predicate(
  		lambda candidate: candidate in members,
  		"one of %s" % ', '.join(map(repr, members)),
  		lambda candidate: "%s not in %s" % (candidate, members)
  	)
  
  def inrange(start, end):
  	return Predicate(
  		lambda candidate: start <= candidate <= end,
  		"between %s and %s" % (start, end),
  		lambda candidate: "%s not between %s and %s" % (candidate, start, end)
  	)
  
subject: Add a Predicate class to make it easy to create custom predicates