def get_stack(topology, node, data=True):
    """Return the stack of a node, if any

    Parameters
    ----------
    topology : Topology
        The topology
    node : any hashable type
        The ID of the node
    data : bool, optional
        If true, returns a tuple of the stack name and its attributes,
        otherwise just the stack name

    Returns
    -------
    stack : tuple (name, properties) or name only
        If data = True, a tuple of two values, where the first value is the
        name of the stack and the second value is the dictionary of its
        properties.
        If data = False returns only the stack name
        If no stack is deployed, return None
    """
    if 'stack' not in topology.node[node]:
        return None
    name, props = topology.node[node]['stack']
    return (name, props) if data else name
