nodes: 0, module; 1, function_definition; 2, function_name:get_variables; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, if_statement; 11, for_statement; 12, return_statement; 13, identifier:sort; 14, None; 15, identifier:collapse_same_ident; 16, False; 17, comment:"""
          Get a list of variables.
  
          :param str or None sort:    Sort of the variable to get.
          :param collapse_same_ident: Whether variables of the same identifier should be collapsed or not.
          :return:                    A list of variables.
          :rtype:                     list
          """; 18, assignment; 19, identifier:collapse_same_ident; 20, block; 21, identifier:var; 22, attribute; 23, block; 24, identifier:variables; 25, identifier:variables; 26, list; 27, raise_statement; 28, identifier:self; 29, identifier:_variables; 30, if_statement; 31, if_statement; 32, expression_statement; 33, call; 34, boolean_operator; 35, block; 36, boolean_operator; 37, block; 38, call; 39, identifier:NotImplementedError; 40, argument_list; 41, comparison_operator:sort == 'stack'; 42, not_operator; 43, continue_statement; 44, comparison_operator:sort == 'reg'; 45, not_operator; 46, continue_statement; 47, attribute; 48, argument_list; 49, identifier:sort; 50, string; 51, call; 52, identifier:sort; 53, string; 54, call; 55, identifier:variables; 56, identifier:append; 57, identifier:var; 58, string_content:stack; 59, identifier:isinstance; 60, argument_list; 61, string_content:reg; 62, identifier:isinstance; 63, argument_list; 64, identifier:var; 65, identifier:SimStackVariable; 66, identifier:var; 67, identifier:SimRegisterVariable
code: def get_variables(self, sort=None, collapse_same_ident=False):
          """
          Get a list of variables.
  
          :param str or None sort:    Sort of the variable to get.
          :param collapse_same_ident: Whether variables of the same identifier should be collapsed or not.
          :return:                    A list of variables.
          :rtype:                     list
          """
  
          variables = [ ]
  
          if collapse_same_ident:
              raise NotImplementedError()
  
          for var in self._variables:
              if sort == 'stack' and not isinstance(var, SimStackVariable):
                  continue
              if sort == 'reg' and not isinstance(var, SimRegisterVariable):
                  continue
              variables.append(var)
  
          return variables