Python port of FLEXWIN