def METHOD_NAME(self, x):
    """Get the subset containing `x`.
    Parameters
    ----------
    x : hashable object
        Input element.
    Returns
    -------
    result : set
        Subset containing `x`.
    """
    if x not in self._indices:
        raise KeyError(x)
    result = [x]
    nxt = self._nbrs[x]
    while self._indices[nxt] != self._indices[x]:
        result.append(nxt)
        nxt = self._nbrs[nxt]
    return set(result)