class_docstr: Utility function to set options at the global level or to provide an
  Options object that can be used with the .options method of an
  element or container.
  
  Option objects can be generated and validated in a tab-completable
  way (in appropriate environments such as Jupyter notebooks) using
  completers such as opts.Curve, opts.Image, opts.Overlay, etc.
  
  To set opts globally you can pass these option objects into opts.defaults:
  
  opts.defaults(*options)
  
  For instance:
  
  opts.defaults(opts.Curve(color='red'))
  
  To set opts on a specific object, you can supply these option
  objects to the .options method.
  
  For instance:
  
  curve = hv.Curve([1,2,3])
  curve.options(opts.Curve(color='red'))
  
  The options method also accepts lists of Option objects.
docstr: Group options by backend and filter out output group appropriately
docstr_tok: ["Group","options","by","backend","and","filter","out","output","group","appropriately"]
code: def _grouped_backends(cls, options, backend):
      "Group options by backend and filter out output group appropriately"
  
      if options is None:
          return [(backend or Store.current_backend, options)]
      dfltdict = defaultdict(dict)
      for spec, groups in options.items():
          if (
              "output" not in groups.keys()
              or len(groups["output"]) == 0
          ):
              dfltdict[backend or Store.current_backend][
                  spec.strip()
              ] = groups
          elif set(groups["output"].keys()) - {"backend"}:
              dfltdict[groups["output"]["backend"]][
                  spec.strip()
              ] = groups
          elif ["backend"] == list(groups["output"].keys()):
              filtered = {
                  k: v for k, v in groups.items() if k != "output"
              }
              dfltdict[groups["output"]["backend"]][
                  spec.strip()
              ] = filtered
          else:
              raise Exception(
                  "The output options group must have the backend keyword"
              )
  
      return [(bk, bk_opts) for (bk, bk_opts) in dfltdict.items()]
  
imports: import inspect
  import os
  import shutil
  import sys
  from collections import defaultdict
  from inspect import Parameter, Signature
  from pathlib import Path
  from types import FunctionType
  import param
  from pyviz_comms import extension
  from ..core import Dataset, Dimensioned, DynamicMap, HoloMap, Store, StoreOptions, ViewableElement, util
  from ..core.operation import Operation, OperationCallable
  from ..core.options import Keywords, Options, options_policy
  from ..core.overlay import Overlay
  from ..core.util import merge_options_to_dict
  from ..operation.element import function
  from ..streams import Params, Stream, streams_list_from_dict
  from .settings import OutputSettings, list_backends, list_formats
label_desc: Use image node_id 5 for calling the opts obj's underlying member method code with example usage: obj._grouped_backends(cls, options, backend) and returns: unknown, list