code: def set_from_match(self, key, regex_list, string):
          
          for item in regex_list:
              if hasattr(item, '__call__'):
                  self.set(key, *item(string))
              else:
                  regex, value, confidence = item
                  if regex.search(string):
                      self.set(key, value, confidence)
docs: Given a list of functions or three-tuples (regex, value, confidence),
          this function walks through them and checks whether any of the
          items in the list matches the given string.
          If the list item is a function, it must have the following
          signature::
  
              func(string) : (string, int)
  
          Where the return value specifies the resulting value and the
          confidence of the match.
          If a match is found, and the confidence level is higher
          than the currently defined one, the given value is defined with
          the given confidence.