<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def conns_to_am(conns, shape=None, force_triu=True, drop_diag=True, drop_dupes=True, drop_negs=True):
 r""" Converts a list of connections into a Scipy sparse adjacency matrix Parameters conns : array_like, N x 2 The list of site-to-site connections shape : list, optional The shape of the array. If none is given then it is inferred from the maximum value in ``conns`` array. force_triu : boolean If True (default), then all connections are assumed undirected, and moved to the upper triangular portion of the array drop_diag : boolean If True (default), then connections from a site and itself are removed. drop_dupes : boolean If True (default), then all pairs of sites sharing multiple connections are reduced to a single connection. drop_negs : boolean If True (default), then all connections with one or both ends pointing to a negative number are removed. """

    if force_triu:  # Sort connections to [low, high]
        conns = sp.sort(conns, axis=1)
    if drop_negs:  # Remove connections to -1
        keep = ~sp.any(conns < 0, axis=1)
        conns = conns[keep]
    if drop_diag:  # Remove connections of [self, self]
        keep = sp.where(conns[:, 0] != conns[:, 1])[0]
        conns = conns[keep]
    # Now convert to actual sparse array in COO format
    data = sp.ones_like(conns[:, 0], dtype=int)
    if shape is None:
        N = conns.max() + 1
        shape = (N, N)
    am = sprs.coo_matrix((data, (conns[:, 0], conns[:, 1])), shape=shape)
    if drop_dupes:  # Convert to csr and back too coo
        am = am.tocsr()
        am = am.tocoo()
    # Perform one last check on adjacency matrix
    missing = sp.where(sp.bincount(conns.flatten()) == 0)[0]
    if sp.size(missing) or sp.any(am.col.max() < (shape[0] - 1)):
        warnings.warn('Some nodes are not connected to any bonds')
    return am