class_docstr: Singleton metaclass interface for
  :class:`fiftyone.core.document.Document` subclasses.
  
  The methods declared by this interface are used by the
  :class:`fiftyone.core.document.Document` class to manage all instances
  of a class that implements this type.
docstr: Retrieves the :class:`fiftyone.core.document.Document` instance for
  the given document, if one exists.
  
  Args:
      doc: a :class:`fiftyone.core.odm.document.Document`
  
  Returns:
      a :class:`fiftyone.core.document.Document` instance, or None
docstr_tok: ["Retrieves","the",":","class",":","`","fiftyone.core.document.Document","`","instance","for","the","given","document",",","if","one","exists",".","Args",":","doc",":","a",":","class",":","`","fiftyone.core.odm.document.Document","`","Returns",":","a",":","class",":","`","fiftyone.core.document.Document","`","instance",",","or","None"]
code: def _get_instance(cls, doc):
      """Retrieves the :class:`fiftyone.core.document.Document` instance for
      the given document, if one exists.
  
      Args:
          doc: a :class:`fiftyone.core.odm.document.Document`
  
      Returns:
          a :class:`fiftyone.core.document.Document` instance, or None
      """
      raise NotImplementedError(
          "subclass must implement _get_instance()"
      )
  
imports: from collections import defaultdict
  import weakref
label_desc: Use image node_id 2 for calling the DocumentSingleton obj's underlying member method code with example usage: obj._get_instance(cls, doc) without return types