import math


def distance(node1,node2):
    """
    Calculates distance between nodes in pixels

    Parameters
    ----------
    node1 : Treelib Node
            first node

    node2 : Treelib Node
            second node

    Returns
    -------
    distance : float
               distance between nodes in pixels
    """
    distance = math.sqrt(
        (node1.data[0][0]-node2.data[0][0])
        *(node1.data[0][0]-node2.data[0][0])
        +(node1.data[0][1]-node2.data[0][1])
        *(node1.data[0][1]-node2.data[0][1]))
    return distance