code: def filter_chromosomes(
      vds: "VariantDataset",
      *,
      keep=None,
      remove=None,
      keep_autosomes=False,
  ) -> "VariantDataset":
      """Filter chromosomes of a :class:`.VariantDataset` in several possible modes.
  
      Notes
      -----
      There are three modes for :func:`filter_chromosomes`, based on which argument is passed
      to the function. Exactly one of the below arguments must be passed by keyword.
  
       - ``keep``: This argument expects a single chromosome identifier or a list of chromosome
         identifiers, and the function returns a :class:`.VariantDataset` with only those
         chromosomes.
       - ``remove``: This argument expects a single chromosome identifier or a list of chromosome
         identifiers, and the function returns a :class:`.VariantDataset` with those chromosomes
         removed.
       - ``keep_autosomes``: This argument expects the value ``True``, and returns a dataset without
         sex and mitochondrial chromosomes.
  
      Parameters
      ----------
      vds : :class:`.VariantDataset`
          Dataset.
      keep
          Keep a specified list of contigs.
      remove
          Remove a specified list of contigs
      keep_autosomes
          If true, keep only autosomal chromosomes.
  
      Returns
      -------
      :class:`.VariantDataset`.
      """
  
      n_args_passed = (
          (keep is not None) + (remove is not None) + keep_autosomes
      )
      if n_args_passed == 0:
          raise ValueError(
              "filter_chromosomes: expect one of 'keep', 'remove', or 'keep_autosomes' arguments"
          )
      if n_args_passed > 1:
          raise ValueError(
              "filter_chromosomes: expect ONLY one of 'keep', 'remove', or 'keep_autosomes' arguments"
              "\n  In order use 'keep_autosomes' with 'keep' or 'remove', call the function twice"
          )
  
      rg = vds.reference_genome
  
      to_keep = []
  
      if keep is not None:
          keep = wrap_to_list(keep)
          to_keep.extend(keep)
      elif remove is not None:
          remove = set(wrap_to_list(remove))
          for c in rg.contigs:
              if c not in remove:
                  to_keep.append(c)
      elif keep_autosomes:
          to_remove = set(rg.x_contigs + rg.y_contigs + rg.mt_contigs)
          for c in rg.contigs:
              if c not in to_remove:
                  to_keep.append(c)
  
      parsed_intervals = hl.literal(to_keep, hl.tarray(hl.tstr)).map(
          lambda c: hl.parse_locus_interval(c, reference_genome=rg)
      )
      return _parameterized_filter_intervals(
          vds,
          intervals=parsed_intervals,
          keep=True,
          mode="unchecked_filter_both",
      )
  
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 10 for calling a global function with example usage: filter_chromosomes(vds) and returns: _parameterized_filter_intervals