code: def replace_key_in_order(odict, key_prev, key_after):
      """Replace ``key_prev`` of ``OrderedDict`` ``odict`` with ``key_after``,
      while leaving its value and the rest of the dictionary intact and in the
      same order.
      """
      tmp = OrderedDict()
      for k, v in odict.items():
          if k == key_prev:
              tmp[key_after] = v
          else:
              tmp[k] = v
      return tmp
  
imports: import logging
  import re
  from collections import OrderedDict
  from scipy.stats import distributions
  from orion.algo.space import Categorical, Fidelity, Integer, Real, Space
  from orion.core.utils.flatten import flatten
label_desc: Use image node_id 4 for calling a global function with example usage: replace_key_in_order(odict, key_prev, key_after) and returns: tmp