code: def apply_replacement_rules(
      rules: AnyStr
      | list[AnyStr | list[AnyStr] | tuple[AnyStr, AnyStr]],
      s: AnyStr,
  ) -> AnyStr:
      r"""Apply replacement rules specified as a single string
  
      Examples
      --------
  
      >>> apply_replacement_rules(r'/my_(.*)\.dat/your_\1.dat.gz', 'd/my_pony.dat')
      'd/your_pony.dat.gz'
  
      Parameters
      ----------
      rules : str, list of str
        Rules of the format '/pat1/replacement', where / is an arbitrary
        character to decide replacement.
  
      Returns
      -------
      str
      """
  
      for regexp, replacement in get_replacement_dict(rules).items():
          s = re.sub(regexp, replacement, s)
  
      return s
  
imports: from __future__ import annotations
  import re
  from typing import AnyStr
label_desc: Use image node_id 2 for calling a global function with example usage: apply_replacement_rules(rules, s) and returns: s