def _is_close(d1, d2, atolerance=0, rtolerance=0):
    """Determines whether two adjacency matrices are within a provided tolerance.
    d1 : dict(Adjacency dictionary)
    d2 : dict(Adjacency dictionary)
    atolerance : Some scalar tolerance value to determine closeness
    rtolerance : A scalar tolerance value that will be some proportion of ``d2``'s value

    Returns : boolean close or not
    """
    # Pre-condition: d1 and d2 have the same keys at each level if they
    # are dictionaries.
    if not isinstance(d1, dict) and not isinstance(d2, dict):
        return abs(d1 - d2) <= atolerance + rtolerance * abs(d2)
    return all(all(_is_close(d1[u][v], d2[u][v]) for v in d1[u]) for u in d1)