code: def find_connecting_bonds(sites, am):
      r
      if am.format != 'dok':
          am = am.todok(copy=False)
      sites = sp.array(sites, ndmin=2)
      if sites.size == 0:
          return []
      z = tuple(zip(sites[:, 0], sites[:, 1]))
      neighbors = [am.get(z[i], None) for i in range(len(z))]
      return neighbors
docs: r"""
      Given pairs of sites, finds the bonds which connects each pair.
  
      Parameters
      ----------
      sites : array_like
          A 2-column vector containing pairs of site indices on each row.
  
      am : scipy.sparse matrix
          The adjacency matrix of the network.  Must be symmetrical such that if
          sites *i* and *j* are connected, the matrix contains non-zero values
          at locations (i, j) and (j, i).
  
      Returns
      -------
      Returns a list the same length as P1 (and P2) with each element
      containing the throat number that connects the corresponding pores,
      or `None`` if pores are not connected.
  
      Notes
      -----
      The returned list can be converted to an ND-array, which will convert
      the ``None`` values to ``nan``.  These can then be found using
      ``scipy.isnan``.