'Button release event handler'

def _release(self, event):

    if (self._active_handle_idx >= 0):
        self._active_handle_idx = (-1)
    elif ((len(self._xs) > 3) and (self._xs[(-1)] == self._xs[0]) and (self._ys[(-1)] == self._ys[0])):
        self._polygon_completed = True
    elif ((not self._polygon_completed) and (u'move_all' not in self.state) and (u'move_vertex' not in self.state)):
        self._xs.insert((-1), event.xdata)
        self._ys.insert((-1), event.ydata)
    if self._polygon_completed:
        self.onselect(self.verts)
