code: def pairs(sel, excluded_neighbors=0):
          
  
          assert isinstance(excluded_neighbors,int)
  
          p = []
          for i in range(len(sel)):
              for j in range(i + 1, len(sel)):
                  # get ordered pair
                  I = sel[i]
                  J = sel[j]
                  if (I > J):
                      I = sel[j]
                      J = sel[i]
                  # exclude 1 and 2 neighbors
                  if (J > I + excluded_neighbors):
                      p.append([I, J])
          return np.array(p)
docs: Creates all pairs between indexes. Will exclude closest neighbors up to :py:obj:`excluded_neighbors`
          The self-pair (i,i) is always excluded
  
          Parameters
          ----------
          sel : ndarray((n), dtype=int)
              array with selected atom indexes
  
          excluded_neighbors: int, default = 0
              number of neighbors that will be excluded when creating the pairs
  
          Returns
          -------
          sel : ndarray((m,2), dtype=int)
              m x 2 array with all pair indexes between different atoms that are at least :obj:`excluded_neighbors`
              indexes apart, i.e. if i is the index of an atom, the pairs [i,i-2], [i,i-1], [i,i], [i,i+1], [i,i+2], will
              not be in :py:obj:`sel` (n=excluded_neighbors) if :py:obj:`excluded_neighbors` = 2.
              Moreover, the list is non-redundant,i.e. if [i,j] is in sel, then [j,i] is not.