def __getitem__(self, key):
    if (key == 'distances'):
        if ('distances' not in self):
            raise KeyError(f'No "{self._dists_key}" in .obsp')
        return self._distances
    elif (key == 'connectivities'):
        if ('connectivities' not in self):
            raise KeyError(f'No "{self._conns_key}" in .obsp')
        return self._connectivities
    else:
        return self._neighbors_dict[key]
def __getitem__(self, key):
    if (key == 'distances'):
        if ('distances' not in self):
            raise KeyError(f'No "{self._dists_key}" in .obsp')
        return self._distances
    elif (key == 'connectivities'):
        if ('connectivities' not in self):
            raise KeyError(f'No "{self._conns_key}" in .obsp')
        return self._connectivities
    else:
        return self._neighbors_dict[key]