code: def lineSeqmentsDoIntersect(line1, line2):
      
      (x1, y1), (x2, y2) = line1
      (u1, v1), (u2, v2) = line2
      (a, b), (c, d) = (x2 - x1, u1 - u2), (y2 - y1, v1 - v2)
      e, f = u1 - x1, v1 - y1
      denom = float(a * d - b * c)
      if _near(denom, 0):
          # parallel
          return False
      else:
          t = old_div((e * d - b * f), denom)
          s = old_div((a * f - e * c), denom)
          # When 0<=t<=1 and 0<=s<=1 the point of intersection occurs within the
          # line segments
          return 0 <= t <= 1 and 0 <= s <= 1
docs: Return True if line segment line1 intersects line segment line2 and
      line1 and line2 are not parallel.