def get_area(ptlist):
    """ Calculate the area of a polygon defined by a list of points.

    The variable ptlist is a list of (x, y) point pairs. Be careful,
    the implementation can give unexpected results with self-intersecting
    polygons.

    The output will always be non-negative.

    Created: 2015 April 29, msswan
    """
    I = lambda pt1, pt2: (pt2[1] + pt1[1]) * (pt2[0] - pt1[0]) / 2.0
    area = I(ptlist[-1], ptlist[0])
    for idx in range(0, len(ptlist)-1):
        area += I(ptlist[idx], ptlist[idx+1])
    return abs(area)