import re


def strip_header(lines, find_header_start, find_header_end, find_shebang = False):
    """ Remove the header lines from a list of file lines.
        We require that the header start on the _first_ line, 
        unless there is a shebang and we are looking for it, in 
        which case it may start on the second line if there is a 
        shebang.
    """
    search_for_header = True
    in_header = False
    new_lines = []

    for l in lines:
        
        # Run once, if ever. But if it's here we need to
        # look before we look for a header.
        if find_shebang:
            find_shebang = False
            # Using match is "like" using regex "^#!"
            match = re.match("#!", l)
            if match:
                new_lines.append(l)
                continue

        # Condition: The header has to start on the first line 
        # (or the second if there's a shebang line present).
        if search_for_header:
            search_for_header = False
            if find_header_start(l):
                in_header = True
                # We need to continue here. If we don't, for files
                # that have symetric comment delimiters we pick up
                # the end marker as the same line as the start.
                continue

        if not in_header:
            new_lines.append(l)

        if in_header:
            if find_header_end(l):
                in_header = False

    return new_lines