def _choose_graph(adata, obsp, neighbors_key):
    'Choose connectivities from neighbbors or another obsp column'
    if ((obsp is not None) and (neighbors_key is not None)):
        raise ValueError("You can't specify both obsp, neighbors_key. Please select only one.")
    if (obsp is not None):
        return adata.obsp[obsp]
    else:
        neighbors = NeighborsView(adata, neighbors_key)
        if ('connectivities' not in neighbors):
            raise ValueError('You need to run `pp.neighbors` first to compute a neighborhood graph.')
        return neighbors['connectivities']
Choose connectivities from neighbbors or another obsp column
def _choose_graph(adata, obsp, neighbors_key):
    
    if ((obsp is not None) and (neighbors_key is not None)):
        raise ValueError("You can't specify both obsp, neighbors_key. Please select only one.")
    if (obsp is not None):
        return adata.obsp[obsp]
    else:
        neighbors = NeighborsView(adata, neighbors_key)
        if ('connectivities' not in neighbors):
            raise ValueError('You need to run `pp.neighbors` first to compute a neighborhood graph.')
        return neighbors['connectivities']