def is_weighted(G):
    """ Determine if a graph G is weighted

    Checks each edge to see if it has attribute 'weight' if it does
    return True, otherwise false. This checks if the entire graph is
    weighted not partial.

    Parameters:
    ----------
    G: A networkx Graph

    Returns:
    --------
    weighted :  A bool
       Determines whether the graph is weighted.
    """
    weighted = True
    for (u,v) in G.edges():
        weighted = weighted and ('weight' in G.edge[u][v])
        if not weighted:
            return weighted
    return weighted