code: function Lock(consul, opts) {
    events.EventEmitter.call(this);
  
    opts = utils.normalizeKeys(opts);
  
    this.consul = consul;
    this._opts = opts;
    this._defaults = utils.defaultCommonOptions(opts);
  
    if (opts.session) {
      switch (typeof opts.session) {
        case 'string':
          opts.session = { id: opts.session };
          break;
        case 'object':
          opts.session = utils.normalizeKeys(opts.session);
          break;
        default:
          throw errors.Validation('session must be an object or string');
      }
    } else {
      opts.session = {};
    }
  
    if (!opts.key) {
      throw errors.Validation('key required');
    } else if (typeof opts.key !== 'string') {
      throw errors.Validation('key must be a string');
    }
  }
docs: Initialize a new `Lock` instance.