code: def validate_filter(filters):
      if filters is None:
          return []
  
      elif (
          isinstance(filters, list)
          and len(filters) > 0
          and not isinstance(filters[0], list)
      ):
          # wrap
          filters = [filters]
  
      if isinstance(filters, list):
          for f in filters:
              if not isinstance(f, list):
                  raise PerspectiveError(
                      "`filter` kwarg must be a list!"
                  )
  
              for i, item in enumerate(f):
                  if i == 1:
                      if item not in ALL_FILTERS:
                          raise PerspectiveError(
                              "Unrecognized filter operator: {}".format(
                                  item
                              )
                          )
                      elif item not in ("is null", "is not null"):
                          if len(f) != 3:
                              raise PerspectiveError(
                                  "Cannot parse filter - {} operator must have a comparison value.".format(
                                      item
                                  )
                              )
                  else:
                      if item.__class__.__name__ == "date":
                          f[i] = item.strftime("%m/%d/%Y")
                      elif isinstance(item, datetime):
                          f[i] = item.strftime("%Y-%m-%d %H:%M:%S")
          return filters
      else:
          raise PerspectiveError(
              "Cannot parse filter type: {}".format(str(type(filters)))
          )
  
file_path: perspective/python/perspective/perspective/viewer/validate.py
imports: from datetime import datetime
  from ..core import ALL_FILTERS, Aggregate, Plugin, Sort
  from ..core.exception import PerspectiveError
label_desc: Use image node_id 8 for calling a global function with example usage: validate_filter(filters) and returns: list, filters