<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def from_igraph(G, attribute="weight", **kwargs):
 """Convert an igraph.Graph to a graphtools.Graph Creates a graphtools.graphs.TraditionalGraph with a precomputed adjacency matrix Parameters G : igraph.Graph Graph to be converted attribute : str, optional (default: "weight") attribute containing edge weights, if any. If None, unweighted graph is built kwargs keyword arguments for graphtools.Graph Returns ------- G : graphtools.graphs.TraditionalGraph """

    if 'precomputed' in kwargs:
        if kwargs['precomputed'] != 'adjacency':
            warnings.warn(
                "Cannot build graph from igraph with precomputed={}. "
                "Use 'adjacency' instead.".format(kwargs['precomputed']),
                UserWarning)
        del kwargs['precomputed']
    try:
        K = G.get_adjacency(attribute=attribute).data
    except ValueError as e:
        if str(e) == "Attribute does not exist":
            warnings.warn("Edge attribute {} not found. "
                          "Returning unweighted graph".format(attribute),
                          UserWarning)
        K = G.get_adjacency(attribute=None).data
    return Graph(sparse.coo_matrix(K),
                 precomputed='adjacency', **kwargs)