def minimal_selector(self, complete_selector):
if complete_selector not in self._selector_map:<EOL><INDENT>raise KeyError("<STR_LIT>".format(complete_selector))<EOL><DEDENT>selector_components = complete_selector.split('<STR_LIT:.>')<EOL>node = self._selector_tree<EOL>start = None<EOL>for i, component in enumerate(reversed(selector_components)):<EOL><INDENT>if len(node) == <NUM_LIT:1>:<EOL><INDENT>if start is None:<EOL><INDENT>start = -i  <EOL><DEDENT><DEDENT>else:<EOL><INDENT>start = None<EOL><DEDENT>node = node[component]<EOL><DEDENT>if len(node) > <NUM_LIT:1>:  <EOL><INDENT>return complete_selector<EOL><DEDENT>return '<STR_LIT:.>'.join(selector_components[start:])<EOL>
Returns the minimal selector that uniquely matches `complete_selector`.

        Args:
          complete_selector: A complete selector stored in the map.

        Returns:
          A partial selector that unambiguously matches `complete_selector`.

        Raises:
          KeyError: If `complete_selector` is not in the map.