code: def _specs_to_dict(opts_raw):
      opts = {}
      for k, v in opts_raw.items():
          if isinstance(v, FeatureSpec):
              opts[k] = v.as_dict()
          elif isinstance(v, dict):
              opts[k] = _specs_to_dict(v)
          else:
              opts[k] = v
  
      return _filter_none(opts)
  
imports: import io
  import json
  import os
  from typing import Union
  from lets_plot._global_settings import get_global_bool, has_global_value, FRAGMENTS_ENABLED
label_desc: Use image node_id 4 for calling a global function with example usage: _specs_to_dict(opts_raw) and returns: _filter_none