def _between_lines(lines, beg, end, single=False):
    """ Extract lines from `beg` to `end`
    :param lines: content list which is split for each newline
    :param beg: starting point of parsing
    :param end: end point of parsing
    :param single: whether there are multiple sections to exist
    :return: extracted lines
    """

    # Initialize variables
    start_idx = -1
    end_idx = -1
    indices = []

    # Parsing
    for idx, line in enumerate(lines):
        if line.startswith(beg):
            start_idx = idx
        if line.startswith(end) and start_idx != -1:
            end_idx = idx

        if start_idx != -1 and end_idx != -1:
            assert end_idx >= start_idx, "must be 'end_idx >= start_idx'"
            indices.append([start_idx, end_idx])

            start_idx = -1
            end_idx = -1

            if single:
                break

    return [lines[item[0]:item[1]] for item in indices]