code: def _get_ents_extractor(ents) -> Optional[types.DocLikeToSpans]:
      if ents is None:
          return None
      elif callable(ents):
          return ents
      elif isinstance(ents, bool):
          return entities
      else:
          raise TypeError()
  
file_path: textacy/src/textacy/extract/basics.py
imports: from __future__ import annotations
  from functools import partial
  from typing import Collection, Iterable, Optional, Union
  from cytoolz import itertoolz
  from spacy.parts_of_speech import DET
  from spacy.tokens import Span, Token
  from ..None import constants, errors, types, utils
label_desc: Use image node_id 9 for calling a global function with example usage: _get_ents_extractor(ents) and returns: None, ents, entities