whole_func_string: function insureFreshToken(conn, cb) {
      var rh = conn.requestHeaders;
      if (rh && rh.authorization &&
          conn.user && rh.authorization.indexOf('Bearer ') === 0) {
        var stashedToken = tokenMgmt.currentToken(conn.user, conn.loginBaseUrl, conn.mgmtServer);
        if (tokenMgmt.isInvalidOrExpired(stashedToken)) {
          return conn.refreshToken(stashedToken, function(e, result){
            if (e) {
              throw new Error('error refreshing token: ' + e );
            }
            cb(merge(true, { headers: rh}));
          });
        }
        else {
          cb(merge(true, { headers: rh}));
        }
      }
      else {
        cb(merge(true, { headers: rh}));
      }
    }
func_code_string: function insureFreshToken(conn, cb) {
      var rh = conn.requestHeaders;
      if (rh && rh.authorization &&
          conn.user && rh.authorization.indexOf('Bearer ') === 0) {
        var stashedToken = tokenMgmt.currentToken(conn.user, conn.loginBaseUrl, conn.mgmtServer);
        if (tokenMgmt.isInvalidOrExpired(stashedToken)) {
          return conn.refreshToken(stashedToken, function(e, result){
            if (e) {
              throw new Error('error refreshing token: ' + e );
            }
            cb(merge(true, { headers: rh}));
          });
        }
        else {
          cb(merge(true, { headers: rh}));
        }
      }
      else {
        cb(merge(true, { headers: rh}));
      }
    }
func_documentation_string: to handle expiry of the oauth token