def _get_block_length(lines, k):
    """ Calculates the length (in number of lines) of a edit of added/deleted lines starting in a
        given line k.

    Args:
        lines: dictionary of added or deleted lines
        k: line number to check for

    Returns:
        block_size: number of lines in the contiguously block that was modified
    """
    if k not in lines or k > 1 and k - 1 in lines:
        edit = False
        block_size = 0
    else:
        edit = True
        block_size = 1
    while edit:
        if k + block_size in lines:
            block_size += 1
        else:
            edit = False
    return block_size
