code: def _recommend_user(algo, req):
      user, n, candidates = req
  
      _logger.debug("generating recommendations for %s", user)
      watch = util.Stopwatch()
      res = algo.recommend(user, n, candidates)
      _logger.debug(
          "%s recommended %d/%s items for %s in %s",
          str(algo),
          len(res),
          n,
          user,
          watch,
      )
  
      res["user"] = user
      res["rank"] = np.arange(1, len(res) + 1)
  
      return res.reset_index(drop=True)
  
file_path: lkpy/lenskit/batch/_recommend.py
imports: import logging
  import warnings
  import pandas
  import numpy
  from ..algorithms import Recommender
  from ..None import util
  from ..sharing import PersistedModel
label_desc: Use image node_id 1 for calling a global function with example usage: _recommend_user(algo, req) and returns: res