code: def match_spec(element, specification):
      
      match_tuple = ()
      match = specification.get((), {})
      for spec in [type(element).__name__,
                   group_sanitizer(element.group, escape=False),
                   label_sanitizer(element.label, escape=False)]:
          match_tuple += (spec,)
          if match_tuple in specification:
              match = specification[match_tuple]
      return match
docs: Matches the group.label specification of the supplied
      element against the supplied specification dictionary
      returning the value of the best match.