code: def _unsugar_count_from(**kw):
      """Builds counting functions from keyword arguments.
  
      Keyword argument filter, prepares a simple ``ordering_func`` from a
      ``count_from`` argument, otherwise passes ``ordering_func`` on unchanged.
      """
  
      count_from = kw.pop("count_from", None)
      if (
          kw.get("ordering_func", None) is None
          and count_from is not None
      ):
          if count_from == 0:
              kw["ordering_func"] = count_from_0
          elif count_from == 1:
              kw["ordering_func"] = count_from_1
          else:
              kw["ordering_func"] = count_from_n_factory(count_from)
      return kw
  
imports: from __future__ import annotations
  from typing import Callable
  from typing import List
  from typing import Optional
  from typing import Sequence
  from typing import TypeVar
  from ..orm.collections import collection
  from ..orm.collections import collection_adapter
label_desc: Use image node_id 5 for calling a global function with example usage: _unsugar_count_from() and returns: kw