def METHOD_NAME(changelog_lines, tag):
    # extract the lines for the version being updated, if already in changelog
    found_version_start = False
    for (i, line) in enumerate(changelog_lines):
        # check for version heading lines eg. "x.x.x yyyy-mm-dd"
        if cpan_version_prog.match(line):
            if line.startswith(tag):
                found_version_start = True
                start = i
            elif found_version_start:
                end = i
                return (start, end)
    if found_version_start:
        # for end of file
        end = len(changelog_lines)
        return (start, end)
    # version does not already exist
    return (None, None)