code: def filter_variants(
      vds: "VariantDataset",
      variants_table: "Table",
      *,
      keep: bool = True,
  ) -> "VariantDataset":
      """Filter variants in a :class:`.VariantDataset`, without removing reference
      data.
  
      Parameters
      ----------
      vds : :class:`.VariantDataset`
          Dataset in VariantDataset representation.
      variants_table : :class:`.Table`
          Variants to filter on.
      keep: :obj:`bool`
          Whether to keep (default), or filter out the variants from `variants_table`.
  
      Returns
      -------
      :class:`.VariantDataset`.
      """
      if keep:
          variant_data = vds.variant_data.semi_join_rows(variants_table)
      else:
          variant_data = vds.variant_data.anti_join_rows(variants_table)
      return VariantDataset(vds.reference_data, variant_data)
  
imports: from typing import Sequence
  import hail
  from hail import ir
  from hail.expr import expr_any, expr_array, expr_interval, expr_locus, expr_str, expr_bool
  from hail.matrixtable import MatrixTable
  from hail.methods.misc import require_first_key_field_locus
  from hail.table import Table
  from hail.typecheck import sequenceof, typecheck, nullable, oneof, enumeration, func_spec, dictof
  from hail.utils.java import Env, info, warning
  from hail.utils.misc import divide_null, new_temp_file, wrap_to_list
  from hail.vds.variant_dataset import VariantDataset
label_desc: Use image node_id 8 for calling a global function with example usage: filter_variants(vds, variants_table) and returns: VariantDataset