code: def get_ordered_predecessors(
      causal_graph: DirectedGraph, node: Any
  ) -> List[Any]:
      """This function returns predecessors of a node in a well-defined order.
  
      This is necessary, because we select subsets of columns in Dataframes by using a node's parents, and these parents
      might not be returned in a reliable order.
      """
      return sorted(causal_graph.predecessors(node))
  
imports: import itertools
  import logging
  import re
  from abc import abstractmethod
  from typing import Any, List, Protocol
  import networkx
  from networkx.algorithms.dag import has_cycle
  from dowhy.utils.api import parse_state
  from dowhy.utils.graph_operations import daggity_to_dot
label_desc: Use image node_id 2 for calling a global function with example usage: get_ordered_predecessors(causal_graph, node) and returns: sorted