function serializeScope(scope, offset) {
    offset = offset ||  '  ';
    var log = [offset + 'Scope(' + scope.$id + '): {'];
    for (var key in scope) {
      if (Object.prototype.hasOwnProperty.call(scope, key) && !key.match(/^(\$|this)/)) {
        log.push('  ' + key + ': ' + angular.toJson(scope[key]));
      }
    }
    var child = scope.$$childHead;
    while (child) {
      log.push(serializeScope(child, offset + '  '));
      child = child.$$nextSibling;
    }
    log.push('}');
    return log.join('\n' + offset);
  }
@ngdoc function
@name angular.mock.dump
@description

*NOTE*: This is not an injectable instance, just a globally available function.

Method for serializing common angular objects (scope, elements, etc..) into strings.
It is useful for logging objects to the console when debugging.

@param {*} object - any object to turn into string.
@return {string} a serialized string of the argument