code: def to_lockfile(stage: "PipelineStage", **kwargs) -> dict:
      assert stage.name
      return {stage.name: to_single_stage_lockfile(stage, **kwargs)}
  
file_path: dvc/dvc/stage/serialize.py
imports: from collections import OrderedDict
  from operator import attrgetter
  from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Optional, Union, no_type_check
  from funcy import post_processing
  from dvc.dependency import ParamsDependency
  from dvc.output import Annotation, Output
  from dvc.utils.collections import apply_diff
  from dvc.utils.serialize import parse_yaml_for_update
  from .params import StageParams
  from .utils import resolve_wdir, split_params_deps
label_desc: Use image node_id 8 for calling a global function with example usage: to_lockfile(stage) and returns: dict