<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def __end_of_list(self, ast_token):
 """Handle end of a list."""

        self.list_level -= 1
        if self.list_level == 0:
            if self.list_entry is not None:
                self.final_ast_tokens.append(self.list_entry)
                self.list_entry = None
            self.final_ast_tokens.append(ast_token)