code: function _getLayerJson(layer, callback) {
      var url = null;
      if(layer.layers !== undefined || ((layer.kind || layer.type) !== undefined)) {
        // layer object contains the layer data
        _.defer(function() { callback(layer); });
        return;
      } else if(layer.table !== undefined && layer.user !== undefined) {
        // layer object points to cartodbjson
        url = cartodbUrl(layer);
      } else if(layer.indexOf) {
        // fetch from url
        url = layer;
      }
      if(url) {
        cdb.core.Loader.get(url, callback);
      } else {
        _.defer(function() { callback(null); });
      }
    }
docs: given layer params fetchs the layer json