def on_segment(point_p, point_q, point_r):
if (point_q.x <= max(point_p.x, point_r.x)<EOL>and point_q.x >= min(point_p.x, point_r.x)<EOL>and point_q.y <= max(point_p.y, point_r.y)<EOL>and point_q.y >= min(point_p.y, point_r.y)):<EOL><INDENT>return True<EOL><DEDENT>return False<EOL>
Given three colinear points p, q, r, the function checks if point q
lies on line segment "pr"

:param point_p:
:type point_p: models.Point
:param point_q:
:type point_q: models.Point
:param point_r:
:type point_r: models.Point
:return: if point r on line segment "pr"
:rtype: bool