code: def _suitable_open(fname, compressed=None):
      """Helper to return an appropriate open() implementation for a JSON file
  
      Parameters
      ----------
      fname: str
        The target file name which will be inspected for a '.xz' extension when
        compressed is None.
      compressed: None or bool, optional
        If not None, determined when the return function will be capable of
        (de)compression. If None, this will be guessed from the file name.
  
      Returns
      -------
      LZMAFile or io.open
        LZMAFile is returned when (de)compression is requested, or the file name
        suggests a compressed file.
      """
      return (
          LZMAFile
          if compressed or compressed is None and fname.endswith(".xz")
          else io.open
      )
  
file_path: datalad/datalad/support/json_py.py
imports: import io
  import codecs
  from os.path import dirname, exists, lexists
  from os import makedirs
  import os
  import os.path
  import json
  from datalad.support.exceptions import CapturedException
  from ..log import lgr
label_desc: Use image node_id 9 for calling a global function with example usage: _suitable_open(fname, compressed) and returns: unknown