code: def split_by_prefix(data: dict) -> dict:
      rx = re.compile(r"\$(\w+)\.")
  
      namespace: dict = defaultdict(dict)
  
      def split_key(key):
          key_parts = rx.split(key, 1)
          if len(key_parts) == 1:
              prefix = ""
              suffix = key_parts[0]
          else:
              _, prefix, suffix = key_parts
  
          return prefix, suffix
  
      for key, value in data.items():
          prefix, suffix = split_key(key)
          namespace[prefix][suffix] = value
  
      return dict(namespace)
  
imports: import re
  from collections import defaultdict
  from toolz.dicttoolz import valmap
  from gluonts.core import serde
label_desc: Use image node_id 1 for calling a global function with example usage: split_by_prefix(data) and returns: dict, prefix,  suffix