code: def _val2hashable(val):
      """Small helper to convert incoming mutables to something hashable
  
      The goal is to be able to put the return value into a set, while
      avoiding conversions that would result in a change of representation
      in a subsequent JSON string.
      """
      if isinstance(val, dict):
          return ReadOnlyDict(val)
      elif isinstance(val, list):
          return tuple(map(_val2hashable, val))
      else:
          return val
  
file_path: datalad/datalad/support/collections.py
imports: from typing import Mapping
label_desc: Use image node_id 1 for calling a global function with example usage: _val2hashable(val) and returns: ReadOnlyDict, tuple, val