code: private Tenant getTenant(Map<String, String> variableMap) {
          String tenantName = variableMap.get("tenant");
          if (Utils.isEmpty(tenantName)) {
              tenantName = TenantService.instance().getDefaultTenantName();
          }
          Tenant tenant = TenantService.instance().getTenant(tenantName);
          if (tenant == null) {
              throw new NotFoundException("Unknown tenant: " + tenantName);
          }
          return tenant;
      }
docs: Get the Tenant context for this command and multi-tenant configuration options.