def Delta(a, b, gapopen = -0.5, gapext = -0.7):
    """
    Helper function for swalignimpconstrained for affine
    gap penalties
    """
    if b > 0:
        return 0
    if b == 0 and a > 0:
        return gapopen
    return gapext