code: def _serialize_params_values(params: List[ParamsDependency]):
      """Returns output of following format, used for lockfile:
          {'params.yaml': {'lr': '1', 'train': 2}, {'params2.yaml': {'lr': '1'}}
  
      Default params file are always kept at the start, followed by others in
      alphabetical order. The param values are sorted too(not recursively though)
      """
      key_vals = OrderedDict()
      for param_dep in sorted(params, key=attrgetter("def_path")):
          dump = param_dep.dumpd()
          path, params = dump[PARAM_PATH], dump[PARAM_PARAMS]
          if isinstance(params, dict):
              kv = [(key, params[key]) for key in sorted(params.keys())]
              key_vals[path] = OrderedDict(kv)
              if path == DEFAULT_PARAMS_FILE:
                  key_vals.move_to_end(path, last=False)
      return key_vals
  
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 5 for calling a global function with example usage: _serialize_params_values(params) and returns: key_vals