code: def _serialize_params_keys(params: Iterable["ParamsDependency"]):
      """
      Returns the following format of data:
       ['lr', 'train', {'params2.yaml': ['lr']}]
  
      The output is sorted, with keys of params from default params file being
      at the first, and then followed by entry of other files in lexicographic
      order. The keys of those custom files are also sorted in the same order.
      """
      keys: List[Union[str, Dict[str, Optional[List[str]]]]] = []
      for param_dep in sorted(params, key=attrgetter("def_path")):
          # when on no_exec, params are not filled and are saved as list
          k: List[str] = sorted(param_dep.params)
          if k and param_dep.def_path == DEFAULT_PARAMS_FILE:
              keys = k + keys  # type: ignore[operator,assignment]
          else:
              keys.append({param_dep.def_path: k or None})
      return keys
  
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 4 for calling a global function with example usage: _serialize_params_keys(params) and returns: keys