code: def _apply_none(expr, f, none):
      if not none:
          if expr is not None:
              expr &= f.exists()
          else:
              expr = f.exists()
      elif expr is not None:
          expr |= ~(f.exists())
  
      return expr
  
imports: from typing import List, Optional
  from bson import ObjectId
  import strawberry
  import fiftyone.core.collections
  import fiftyone.core.dataset
  from fiftyone.core.expressions import ViewField, VALUE
  import fiftyone.core.fields
  import fiftyone.core.labels
  import fiftyone.core.media
  import fiftyone.core.stages
  import fiftyone.core.utils
  import fiftyone.core.view
  from fiftyone.server.aggregations import GroupElementFilter, SampleFilter
  from fiftyone.server.scalars import BSONArray, JSON
label_desc: Use image node_id 16 for calling a global function with example usage: _apply_none(expr, f, none) and returns: expr