public function preImport(CommandData $commandData) {
    $userid = $commandData->input()->getOption('userid');
    if ($userid) {
      $account = User::load($userid);
      $accountSwitcher = \Drupal::service('account_switcher');
      $userSession = new UserSession([
        'uid'   => $account->id(),
        'name'  => $account->getUsername(),
        'roles' => $account->getRoles(),
      ]);
      $accountSwitcher->switchTo($userSession);
      $this->logger()->notice(
          dt(
              'Now acting as user ID @id',
              ['@id' => \Drupal::currentUser()->id()]
            )
      );
    }
  }