code: def normalize_args(dim: Dimension, rv, kwarg_order=None) -> dict:
      """Create an argument array from kwargs"""
      if kwarg_order is None:
          kwarg_order = ["loc", "scale"]
  
      if len(dim._kwargs) == 0:
          return dim._args[: len(kwarg_order)]
  
      args = list(deepcopy(dim._args))
  
      for i, kw in enumerate(kwarg_order):
          _upsert(args, i, dim._kwargs.get(kw))
  
      return args[: len(kwarg_order)]
  
imports: from __future__ import annotations
  from copy import deepcopy
  from functools import singledispatch
  from math import log10
  from orion.algo.space import Categorical, Dimension, Fidelity, Integer, Real, Space, SpaceConverter, to_orionspace
label_desc: Use image node_id 3 for calling a global function with example usage: normalize_args(dim, rv, kwarg_order) and returns: args, dim