def point_on_line(point, line_start, line_end, accuracy=50.):
    """Checks whether a point lies on a line

    The function checks whether the point "point" (P) lies on the line defined by its starting point line_start (A) and
    its end point line_end (B).
    This is done by comparing the distance of [AB] with the sum of the distances [AP] and [PB]. If the difference is
    smaller than [AB] / accuracy, the point P is assumed to be on the line. By increasing the value of accuracy (the
    default is 50), the tolerance is decreased.
    :param point: Point to be checked (tuple with x any y coordinate)
    :param line_start: Starting point of the line (tuple with x any y coordinate)
    :param line_end: End point of the line (tuple with x any y coordinate)
    :param accuracy: The higher this value, the less distance is tolerated
    :return: True if the point is one the line, False if not
    """
    length = dist(line_start, line_end)
    ds = length / float(accuracy)
    if -ds < (dist(line_start, point) + dist(point, line_end) - length) < ds:
        return True

    return False