code: function getTermsForCollectingMultiplication(node) {
    let terms = {};
  
    for(let i = 0; i < node.args.length; i++) {
      let child = node.args[i];
  
      if (Node.Type.isUnaryMinus(child)) {
        terms = Util.appendToArrayInObject(
          terms, CONSTANT, Node.Creator.constant(-1));
        child = child.args[0];
      }
      if (Node.PolynomialTerm.isPolynomialTerm(child)) {
        terms = addToTermsforPolynomialMultiplication(terms, child);
      }
      else if (Node.Type.isIntegerFraction(child)) {
        terms = Util.appendToArrayInObject(terms, CONSTANT, child);
      }
      else if (Node.Type.isConstant(child)) {
        terms = Util.appendToArrayInObject(terms, CONSTANT, child);
      }
      else if (Node.Type.isOperator(node) ||
               Node.Type.isFunction(node) ||
               Node.Type.isParenthesis(node) ||
               Node.Type.isUnaryMinus(node)) {
        terms = Util.appendToArrayInObject(terms, OTHER, child);
      }
      else {
        // Note that we shouldn't get any symbol nodes in the switch statement
        // since they would have been handled by isPolynomialTerm
        throw Error('Unsupported node type: ' + child.type);
      }
    }
    return terms;
  }
docs: Collects like terms in a multiplication expression tree into categories. For multiplication, polynomial terms with constants are separated into a symbolic term and a constant term. Returns a dictionary of termname to lists of nodes with that name e.g. 2x + 4 + 5x^2 would return {'x': [x, x^2], CONSTANT: [2, 4, 5]} (where x, x^2, 2, 4, and 5 would actually be expression trees)