def get_first_unindent(indent, file, start_line, annotation_dict,
    encapsulators, comments):
    """
    Get the first case of a valid unindentation.

    :param indent:          No. of spaces to check unindent against.
    :param file:            A tuple of strings.
    :param start_line:      The line from where to start searching for
                            unindent.
    :param annotation_dict: A dictionary containing sourceranges of all the
                            strings and comments within a file.
    :param encapsulators:   A tuple of SourceRanges of code regions trapped in
                            between a matching pair of encapsulators.
    :param comments:        A dict containing all the types of comments
                            specifiers in a language.
    :return:                The line where unindent is found (intial 0).
    """
    line_nr = start_line
    while line_nr < len(file):
        valid = True
        for comment in annotation_dict['comments']:
            if (comment.start.line < line_nr + 1 and comment.end.line >= 
                line_nr + 1):
                valid = False
            first_char = file[line_nr].lstrip()[0] if file[line_nr].strip(
                ) else ''
            if first_char in comments:
                valid = False
        for encapsulator in encapsulators:
            if (encapsulator.start.line < line_nr + 1 and encapsulator.end.
                line >= line_nr + 1):
                valid = False
        line_indent = len(file[line_nr]) - len(file[line_nr].lstrip())
        if line_indent <= indent and valid:
            return line_nr
        line_nr += 1
    return line_nr
