docstr: Serializes the sample to a JSON dictionary.
  
  Args:
      include_frames (False): whether to include the frame labels for
          video samples
      include_private (False): whether to include private fields
  
  Returns:
      a JSON dict
code: def to_dict(self, include_frames=False, include_private=False):
      """Serializes the sample to a JSON dictionary.
  
      Args:
          include_frames (False): whether to include the frame labels for
              video samples
          include_private (False): whether to include private fields
  
      Returns:
          a JSON dict
      """
      d = super().to_dict(include_private=include_private)
  
      if self.media_type == fomm.VIDEO:
          if include_frames:
              d["frames"] = self.frames._to_frames_dict(
                  include_private=include_private
              )
          else:
              d.pop("frames", None)
  
      return d
  
imports: import os
  from bson import ObjectId
  from fiftyone.core.document import Document, DocumentView
  import fiftyone.core.frame
  import fiftyone.core.frame_utils
  import fiftyone.core.labels
  import fiftyone.core.metadata
  import fiftyone.core.media
  import fiftyone.core.odm
  import fiftyone.core.utils
  from fiftyone.core.singletons import SampleSingleton
label_desc: Use image node_id 17 for calling the _SampleMixin obj's underlying member method code with example usage: obj.to_dict(include_frames, include_private) and returns: d