def prepare_tensor_or_dict(g, data, name):
    """Convert data to either a tensor or a dictionary depending on input type.

    Parameters
    ----------
    g : DGLGraph
        Graph.
    data : dict[str, (int, iterable of int, tensor)]
        Data dict.
    name : str
        Name of the data.

    Returns
    -------
    tensor or dict[str, tensor]
    """
    return (
        prepare_tensor_dict(g, data, name)
        if isinstance(data, Mapping)
        else prepare_tensor(g, data, name)
    )
Convert data to either a tensor or a dictionary depending on input type.

    Parameters
    ----------
    g : DGLGraph
        Graph.
    data : dict[str, (int, iterable of int, tensor)]
        Data dict.
    name : str
        Name of the data.

    Returns
    -------
    tensor or dict[str, tensor]
    
python/dgl/utils/checks.py