nodes: 0, module; 1, function_definition; 2, function_name:check_internal_consistency; 3, parameters; 4, block; 5, identifier:self; 6, dictionary_splat_pattern; 7, expression_statement; 8, expression_statement; 9, for_statement; 10, return_statement; 11, identifier:kwargs; 12, comment:"""Check whether the database is internally consistent
  
          We check that all variables are equal to the sum of their sectoral
          components and that all the regions add up to the World total. If
          the check is passed, None is returned, otherwise a dictionary of
          inconsistent variables is returned.
  
          Note: at the moment, this method's regional checking is limited to
          checking that all the regions sum to the World region. We cannot
          make this more automatic unless we start to store how the regions
          relate, see
          [this issue](https://github.com/IAMconsortium/pyam/issues/106).
  
          Parameters
          ----------
          kwargs: passed to `np.isclose()`
          """; 13, assignment; 14, identifier:variable; 15, call; 16, block; 17, conditional_expression:inconsistent_vars if inconsistent_vars else None; 18, identifier:inconsistent_vars; 19, dictionary; 20, attribute; 21, argument_list; 22, expression_statement; 23, if_statement; 24, expression_statement; 25, if_statement; 26, identifier:inconsistent_vars; 27, identifier:inconsistent_vars; 28, None; 29, identifier:self; 30, identifier:variables; 31, assignment; 32, comparison_operator:diff_agg is not None; 33, block; 34, assignment; 35, comparison_operator:diff_regional is not None; 36, block; 37, identifier:diff_agg; 38, call; 39, identifier:diff_agg; 40, None; 41, expression_statement; 42, identifier:diff_regional; 43, call; 44, identifier:diff_regional; 45, None; 46, expression_statement; 47, attribute; 48, argument_list; 49, assignment; 50, attribute; 51, argument_list; 52, assignment; 53, identifier:self; 54, identifier:check_aggregate; 55, identifier:variable; 56, dictionary_splat; 57, subscript; 58, identifier:diff_agg; 59, identifier:self; 60, identifier:check_aggregate_region; 61, identifier:variable; 62, dictionary_splat; 63, subscript; 64, identifier:diff_regional; 65, identifier:kwargs; 66, identifier:inconsistent_vars; 67, binary_operator:variable + "-aggregate"; 68, identifier:kwargs; 69, identifier:inconsistent_vars; 70, binary_operator:variable + "-regional"; 71, identifier:variable; 72, string:"-aggregate"; 73, identifier:variable; 74, string:"-regional"
code: def check_internal_consistency(self, **kwargs):
          """Check whether the database is internally consistent
  
          We check that all variables are equal to the sum of their sectoral
          components and that all the regions add up to the World total. If
          the check is passed, None is returned, otherwise a dictionary of
          inconsistent variables is returned.
  
          Note: at the moment, this method's regional checking is limited to
          checking that all the regions sum to the World region. We cannot
          make this more automatic unless we start to store how the regions
          relate, see
          [this issue](https://github.com/IAMconsortium/pyam/issues/106).
  
          Parameters
          ----------
          kwargs: passed to `np.isclose()`
          """
          inconsistent_vars = {}
          for variable in self.variables():
              diff_agg = self.check_aggregate(variable, **kwargs)
              if diff_agg is not None:
                  inconsistent_vars[variable + "-aggregate"] = diff_agg
  
              diff_regional = self.check_aggregate_region(variable, **kwargs)
              if diff_regional is not None:
                  inconsistent_vars[variable + "-regional"] = diff_regional
  
          return inconsistent_vars if inconsistent_vars else None