code: def __standard_cand_fun(candidates):
      """
      Convert candidates from the forms accepted by :py:fun:`recommend` into
      a standard form, a function that takes a user and returns a candidate
      list.
      """
      if isinstance(candidates, dict):
          return candidates.get
      elif candidates is None:
          return lambda u: None
      else:
          return candidates
  
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 2 for calling a global function with example usage: __standard_cand_fun(candidates) and returns: candidates, function, candidates