code: def match_pattern(regex):
      
  
      prog = re.compile(regex)
      def checker(v):
          result = prog.match(v)
          if result is None:
              raise ValueError(v)
      return checker
docs: Return a value check function which raises a ValueError if the value does
      not match the supplied regular expression, see also `re.match`.