function tag(name, options, close, cb) {
  if (typeof close === 'function') {
    cb = close;
    close = true;
  }
  if (typeof options === 'function') {
    cb = options;
    close = true;
    options = {};
  } else if (typeof options === 'boolean') {
    close = options;
    options = {};
  }
  
  var end = close ? '/>' : '>';
  var out = '<' + name;
  for (var attr in options) {
    out += ' ' + attr + '="' + options[attr] + '"';
  }
  if (cb && close) {
    var content = cb();
    if (content && content.length) {
      out += '>';
      out += content;
      end = '</' + name + '>';
    }
  }
  out += end;
  return out;
}
Construct an HTML tag.

Examples:

   tag('br');
   // => "<br>"

   tag('br', true);
   // => "<br/>"

   tag('img', { src: '/image.png', width: 100, height: 60 });
   // => "<img src="/image.png" width="100" height="60">"

   tag('img', { src: '/image.png', width: 100, height: 60 }, true);
   // => "<img src="/image.png" width="100" height="60"/>"

   tag('p', function() { return 'hello' });
   // => "<p>hello</p>"

   tag('p', { id: 'intro' }, function() { return 'hello' });
   // => "<p id="intro">hello</p>"

@param {String} name
@param {Object} options
@param {Boolean|Function} close or callback
@return {String}
@api public