code: def _is_valid_dkim(self, value):
          
          validator_dict = {'h': lambda val: val in ['sha1', 'sha256'],
                            's': lambda val: val in ['*', 'email'],
                            't': lambda val: val in ['y', 's'],
                            'v': lambda val: val == 'DKIM1',
                            'k': lambda val: val == 'rsa',
                            'n': lambda _: True,
                            'g': lambda _: True}
  
          splitted = value.split('\\;')
          found_key = False
          for splitted_value in splitted:
              sub_split = map(lambda x: x.strip(), splitted_value.split("=", 1))
              if len(sub_split) < 2:
                  return False
              key, value = sub_split[0], sub_split[1]
              if key == "p":
                  is_valid_key = self._is_valid_dkim_key(value)
                  if not is_valid_key:
                      return False
                  found_key = True
              else:
                  is_valid_key = validator_dict.get(key, lambda _: False)(value)
                  if not is_valid_key:
                      return False
          return found_key
docs: Check if value is a valid DKIM