code: function(fn) {
  
                  return function() {
  
                      var args = Array.from(arguments);
                      var n = args.length;
                      var cells = n > 0 && args[0] || [];
                      var opt = n > 1 && args[n - 1] || {};
  
                      if (!Array.isArray(cells)) {
  
                          if (opt instanceof joint.dia.Cell) {
                              cells = args;
                          } else if (cells instanceof joint.dia.Cell) {
                              if (args.length > 1) {
                                  args.pop();
                              }
                              cells = args;
                          }
                      }
  
                      if (opt instanceof joint.dia.Cell) {
                          opt = {};
                      }
  
                      return fn.call(this, cells, opt);
                  };
              }
docs: /*
  Prepares a function with the following usage:
  
  fn([cell, cell, cell], opt);
  fn([cell, cell, cell]);
  fn(cell, cell, cell, opt);
  fn(cell, cell, cell);
  fn(cell);