<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def distance(line, point):
 """ infinite line to point or line to line distance is point is given as line - use middle point of that liune """

    x0, y0, x1, y1 = line
    try:
        p1, p2 = point
    except ValueError:
        # line is given instead of point
        p1, p2 = middle(point)
    n1 = ascent(line)
    n2 = -1
    n0 = y0 - n1 * x0
    return abs(n1 * p1 + n2 * p2 + n0) / (n1 ** 2 + n2 ** 2) ** 0.5