code: def get_sample_filter(slices):
      if slices:
          return SampleFilter(
              group=GroupElementFilter(id=None, slices=slices)
          )
  
imports: import itertools
  from starlette.endpoints import HTTPEndpoint
  from starlette.requests import Request
  import fiftyone.core.fields
  import fiftyone.core.stages
  from fiftyone.core.utils import run_sync_task
  from fiftyone.server.decorators import route
  import fiftyone.server.utils
  import fiftyone.server.view
  from fiftyone.server.filters import GroupElementFilter, SampleFilter
label_desc: Use image node_id 1 for calling a global function with example usage: get_sample_filter(slices) and returns: SampleFilter