human
Complete this python program:
def between(marker, what=None, keepempty=False, exclude=False):
assistant
#Here=None, keepempty=False, exclude=False):
.

    """Return a listener that either keeps, or if *exclude* is True excludes,
    lines between lines that match the *marker* regular expression.  If no line
    matches, the resulting docstring would be empty, so no change will be made
    unless *keepempty* is true.
    If *what* is a sequence of strings, only docstrings of a type in *what* will
    be processed.
    """
    marker_re = re.compile(marker)
    def process(app, what_, name, obj, options, lines):
        if (what and (what_ not in what)):
            return
        deleted = 0
        delete = (not exclude)
        orig_lines = lines[:]
        for (i, line) in enumerate(orig_lines):
            if delete:
                lines.pop((i - deleted))
                deleted += 1
            if marker_re.match(line):
                delete = (not delete)
                if delete:
                    lines.pop((i - deleted))
                    deleted += 1
        if ((not lines) and (not keepempty)):
            lines[:] = orig_lines
        if (lines and lines[(-1)]):
            lines.append('')
    return process