code: def ds_close(args):
      print("Finalizing dataset id {}".format(args.id))
      check_null_id(args)
      print_args(args)
      ds = Dataset.get(dataset_id=args.id)
      if ds.is_dirty():
          if args.disable_upload:
              raise ValueError(
                  "Pending uploads, cannot finalize dataset. run `clearml-data upload`"
              )
          # upload the files
          print(
              "Pending uploads, starting dataset upload to {}".format(
                  args.storage or ds.get_default_storage()
              )
          )
          ds.upload(
              show_progress=True,
              verbose=args.verbose,
              output_url=args.storage or None,
              chunk_size=args.chunk_size or -1,
              max_workers=args.max_workers,
          )
  
      ds.finalize()
      print("Dataset closed and finalized")
      clear_state()
      return 0
  
imports: import json
  import os
  import shutil
  from argparse import ArgumentParser, HelpFormatter
  from functools import partial
  from typing import Sequence
  from pathlib2 import Path
  import clearml.backend_api.session
  from clearml.datasets import Dataset
  from clearml.version import __version__
label_desc: Use image node_id 15 for calling a global function with example usage: ds_close(args) and returns: int