code: def GetKeyByPath(self, key_path):
      
      root_key_path, _, key_path = key_path.partition(
          definitions.KEY_PATH_SEPARATOR)
  
      # Resolve a root key alias.
      root_key_path = root_key_path.upper()
      root_key_path = self._ROOT_KEY_ALIASES.get(root_key_path, root_key_path)
  
      if root_key_path not in self._ROOT_KEYS:
        raise RuntimeError('Unsupported root key: {0:s}'.format(root_key_path))
  
      key_path = definitions.KEY_PATH_SEPARATOR.join([root_key_path, key_path])
      key_path_upper = key_path.upper()
  
      for virtual_key_path, virtual_key_callback in self._VIRTUAL_KEYS:
        virtual_key_path_upper = virtual_key_path.upper()
        if key_path_upper.startswith(virtual_key_path_upper):
          key_path_suffix = key_path[len(virtual_key_path):]
  
          callback_function = getattr(self, virtual_key_callback)
          virtual_key = callback_function(key_path_suffix)
          if not virtual_key:
            raise RuntimeError('Unable to resolve virtual key: {0:s}.'.format(
                virtual_key_path))
  
          return virtual_key
  
      key_path_prefix_upper, registry_file = self._GetFileByPath(key_path_upper)
      if not registry_file:
        return None
  
      if not key_path_upper.startswith(key_path_prefix_upper):
        raise RuntimeError('Key path prefix mismatch.')
  
      key_path_suffix = key_path[len(key_path_prefix_upper):]
      key_path = key_path_suffix or definitions.KEY_PATH_SEPARATOR
      return registry_file.GetKeyByPath(key_path)
docs: Retrieves the key for a specific path.
  
      Args:
        key_path (str): Windows Registry key path.
  
      Returns:
        WinRegistryKey: Windows Registry key or None if not available.
  
      Raises:
        RuntimeError: if the root key is not supported.