docs: def toolchain_spec_prepare_loaderplugins(
          toolchain, spec,
          loaderplugin_read_key,
          handler_sourcepath_key,
          loaderplugin_sourcepath_map_key=LOADERPLUGIN_SOURCEPATH_MAPS):
      """
      A standard helper function for combining the filtered (e.g. using
      ``spec_update_sourcepath_filter_loaderplugins``) loaderplugin
      sourcepath mappings back into one that is usable with the standard
      ``toolchain_spec_compile_entries`` function.
  
      Arguments:
  
      toolchain
          The toolchain
      spec
          The spec
  
      loaderplugin_read_key
          The read_key associated with the loaderplugin process as set up
          for the Toolchain that implemented this.  If the toolchain has
          this in its compile_entries:
  
              ToolchainSpecCompileEntry('loaderplugin', 'plugsrc', 'plugsink')
  
          The loaderplugin_read_key it must use will be 'plugsrc'.
  
      handler_sourcepath_key
          All found handlers will have their handler_sourcepath method be
          invoked, and the combined results will be a dict stored in the
          spec under that key.
  
      loaderplugin_sourcepath_map_key
          It must be the same key to the value produced by
          ``spec_update_sourcepath_filter_loaderplugins``
      """
  
      # ensure the registry is applied to the spec
      registry = spec_update_loaderplugin_registry(
          spec, default=toolchain.loaderplugin_registry)
  
      # this one is named like so for the compile entry method
      plugin_sourcepath = dict_setget_dict(
          spec, loaderplugin_read_key + '_sourcepath')
      # the key is supplied by the toolchain that might make use of this
      if handler_sourcepath_key:
          handler_sourcepath = dict_setget_dict(spec, handler_sourcepath_key)
      else:
          # provide a null value for this.
          handler_sourcepath = {}
  
      for key, value in spec.get(loaderplugin_sourcepath_map_key, {}).items():
          handler = registry.get(key)
          if handler:
              # assume handler will do the job.
              logger.debug("found handler for '%s' loader plugin", key)
              plugin_sourcepath.update(value)
              logger.debug(
                  "plugin_sourcepath updated with %d keys", len(value))
              # TODO figure out how to address the case where the actual
              # JavaScript module for the handling wasn't found.
              handler_sourcepath.update(
                  handler.generate_handler_sourcepath(toolchain, spec, value))
          else:
              logger.warning(
                  "loaderplugin handler for '%s' not found in loaderplugin "
                  "registry '%s'; as arguments associated with loader plugins "
                  "are specific, processing is disabled for this group; the "
                  "sources referenced by the following names will not be "
                  "compiled into the build target: %s",
                  key, registry.registry_name, sorted(value.keys()),
              )