class_docstr: Implements the TAB-completion for the %%opts magic.
docstr: Supply the appropriate key in Store.options and supply
  suggestions for further completion.
docstr_tok: ["Supply","the","appropriate","key","in","Store.options","and","supply","suggestions","for","further","completion","."]
code: def dotted_completion(cls, line, sorted_keys, compositor_defs):
      """
      Supply the appropriate key in Store.options and supply
      suggestions for further completion.
      """
      completion_key, suggestions = None, []
      tokens = [t for t in reversed(line.replace(".", " ").split())]
      for i, token in enumerate(tokens):
          key_checks = []
          if i >= 0:  # Undotted key
              key_checks.append(tokens[i])
          if i >= 1:  # Single dotted key
              key_checks.append(
                  ".".join([key_checks[-1], tokens[i - 1]])
              )
          if i >= 2:  # Double dotted key
              key_checks.append(
                  ".".join([key_checks[-1], tokens[i - 2]])
              )
          # Check for longest potential dotted match first
          for key in reversed(key_checks):
              if key in sorted_keys:
                  completion_key = key
                  depth = completion_key.count(".")
                  suggestions = [
                      k.split(".")[depth + 1]
                      for k in sorted_keys
                      if k.startswith(completion_key + ".")
                  ]
                  return completion_key, suggestions
          # Attempting to match compositor definitions
          if token in compositor_defs:
              completion_key = compositor_defs[token]
              break
      return completion_key, suggestions
  
imports: import sys
  import time
  from IPython.core.magic import Magics, line_cell_magic, line_magic, magics_class
  from IPython.display import HTML, display
  from ..core.options import Options, Store, StoreOptions, options_policy
  from ..core.pprint import InfoPrinter
  from ..operation import Compositor
  from IPython.core import page
label_desc: Use image node_id 2 for calling the OptsCompleter obj's underlying member method code with example usage: obj.dotted_completion(cls, line, sorted_keys, compositor_defs) and returns: completion_key,  suggestions, completion_key,  suggestions