code: def load_stage(
      cls, dvcfile: "ProjectFile", name, stage_data, lock_data=None
  ):
      assert all([name, dvcfile, dvcfile.repo, dvcfile.path])
      assert stage_data
      assert isinstance(stage_data, dict)
  
      path, wdir = resolve_paths(
          dvcfile.repo.fs,
          dvcfile.path,
          stage_data.get(Stage.PARAM_WDIR),
      )
      stage = loads_from(
          PipelineStage, dvcfile.repo, path, wdir, stage_data
      )
      stage.name = name
      stage.desc = stage_data.get(Stage.PARAM_DESC)
      stage.meta = stage_data.get(Stage.PARAM_META)
  
      deps = project(stage_data, [stage.PARAM_DEPS, stage.PARAM_PARAMS])
      fill_stage_dependencies(stage, **deps)
  
      outs = project(
          stage_data,
          [
              stage.PARAM_OUTS,
              stage.PARAM_METRICS,
              stage.PARAM_PLOTS,
          ],
      )
      stage.outs = lcat(
          output.load_from_pipeline(stage, data, typ=key)
          for key, data in outs.items()
      )
  
      if lock_data:
          stage.cmd_changed = (
              lock_data.get(Stage.PARAM_CMD) != stage.cmd
          )
  
      cls.fill_from_lock(stage, lock_data)
      return stage
  
imports: from collections.abc import Mapping
  from copy import deepcopy
  from itertools import chain
  from typing import TYPE_CHECKING, Any, Dict, Iterable, Optional, Tuple
  from funcy import get_in, lcat, once, project
  from dvc import dependency, output
  from dvc.log import logger
  from dvc.parsing import FOREACH_KWD, JOIN, MATRIX_KWD, EntryNotFound
  from dvc.utils.objects import cached_property
  from dvc_data.hashfile.meta import Meta
  from .None import PipelineStage, Stage, loads_from
  from .exceptions import StageNameUnspecified, StageNotFound
  from .params import StageParams
  from .utils import fill_stage_dependencies, resolve_paths
label_desc: Use image node_id 4 for calling the StageLoader obj's underlying member method code with example usage: obj.load_stage(cls, dvcfile, name, stage_data, lock_data) and returns: stage