<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def calc_rel_pos_to_parent(canvas, item, handle):
 """This method calculates the relative position of the given item's handle to its parent :param canvas: Canvas to find relative position in :param item: Item to find relative position to parent :param handle: Handle of item to find relative position to :return: Relative position (x, y) """

    from gaphas.item import NW

    if isinstance(item, ConnectionView):
        return item.canvas.get_matrix_i2i(item, item.parent).transform_point(*handle.pos)

    parent = canvas.get_parent(item)
    if parent:
        return item.canvas.get_matrix_i2i(item, parent).transform_point(*handle.pos)
    else:
        return item.canvas.get_matrix_i2c(item).transform_point(*item.handles()[NW].pos)