def METHOD_NAME(keyset: bytes, p: Any, lang: str) -> bool:
  """Checks if the given keyset can be instantiated as 'p' in the 'lang'.
  Returns true if it is expected that the keyset can be instantiated in language
  'lang', according to the current configuration stored in tink_config. This
  only looks at the key types in the keyset, and does not check if the keys
  themselves are valid. It also does not check that the keyset is valid.
  Args:
    keyset: The serialized keyset
    p: The primitive class, e.g. aead.Aead
    lang: The language, e.g. 'python' or 'java'.
  Returns:
    True iff all key types are for this primitive and supported in the given
    language.
  """
  key_types = _key_types_in_keyset(keyset)
  for key_type in key_types:
    if primitive_for_keytype(key_type) != p:
      return False
    if lang not in supported_languages_for_key_type(key_type):
      return False
  return True