<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def point_in_triangle(p, v1, v2, v3):
 """Checks whether a point is within the given triangle The function checks, whether the given point p is within the triangle defined by the the three corner point v1, v2 and v3. This is done by checking whether the point is on all three half-planes defined by the three edges of the triangle. :param p: The point to be checked (tuple with x any y coordinate) :param v1: First vertex of the triangle (tuple with x any y coordinate) :param v2: Second vertex of the triangle (tuple with x any y coordinate) :param v3: Third vertex of the triangle (tuple with x any y coordinate) :return: True if the point is within the triangle, False if not """

    def _test(p1, p2, p3):
        return (p1[0] - p3[0]) * (p2[1] - p3[1]) - (p2[0] - p3[0]) * (p1[1] - p3[1])

    b1 = _test(p, v1, v2) < 0.0
    b2 = _test(p, v2, v3) < 0.0
    b3 = _test(p, v3, v1) < 0.0

    return (b1 == b2) and (b2 == b3)