def _end_of_set_index(string, start_index):
 length = len(string)
 closing_index = start_index
 if ((closing_index < length) and (string[closing_index] == '!')):
  closing_index += 1
 if (closing_index < length):
  closing_index += 1
 while ((closing_index < length) and (string[closing_index] != ']')):
  closing_index += 1
 return closing_index

def _end_of_set_index ( string , start_index ) : length = len ( string ) closing_index = start_index if ( ( closing_index < length ) and ( string [ closing_index ] == '!' ) ) : closing_index += 1 if ( closing_index < length ) : closing_index += 1 while ( ( closing_index < length ) and ( string [ closing_index ] != ']' ) ) : closing_index += 1 return closing_index
returns the position of the appropriate closing bracket for a glob set in string .