code: def _download_cli(cfg, is_cli_call=True):
      tag_name = str(cfg["tag_name"])
      dataset_id = str(cfg["dataset_id"])
      token = str(cfg["token"])
  
      if not tag_name or not token or not dataset_id:
          print_as_warning(
              "Please specify all of the parameters tag_name, token and dataset_id"
          )
          print_as_warning("For help, try: lightly-download --help")
          return
  
      # set the number of workers if unset
      if cfg["loader"]["num_workers"] < 0:
          # set the number of workers to the number of CPUs available,
          # but minimum of 8
          num_workers = max(8, cpu_count())
          num_workers = min(32, num_workers)
          cfg["loader"]["num_workers"] = num_workers
  
      api_workflow_client = ApiWorkflowClient(
          token=token,
          dataset_id=dataset_id,
          creator=Creator.USER_PIP_LIGHTLY_MAGIC,
      )
  
      # get tag id
      tag_data = api_workflow_client.get_tag_by_name(tag_name)
      filenames_tag = api_workflow_client.get_filenames_in_tag(
          tag_data,
          exclude_parent_tag=cfg["exclude_parent_tag"],
      )
  
      # store sample names in a .txt file
      filename = tag_name + ".txt"
      with open(filename, "w") as f:
          for item in filenames_tag:
              f.write("%s\n" % item)
  
      filepath = os.path.join(os.getcwd(), filename)
      msg = f'The list of samples in tag {cfg["tag_name"]} is stored at: {bcolors.OKBLUE}{filepath}{bcolors.ENDC}'
      print(msg, flush=True)
  
      if not cfg["input_dir"] and cfg["output_dir"]:
          # download full images from api
          output_dir = fix_input_path(cfg["output_dir"])
          api_workflow_client.download_dataset(
              output_dir,
              tag_name=tag_name,
              max_workers=cfg["loader"]["num_workers"],
          )
  
      elif cfg["input_dir"] and cfg["output_dir"]:
          input_dir = fix_input_path(cfg["input_dir"])
          output_dir = fix_input_path(cfg["output_dir"])
          print(
              f"Copying files from {input_dir} to {bcolors.OKBLUE}{output_dir}{bcolors.ENDC}."
          )
  
          # create a dataset from the input directory
          dataset = data.LightlyDataset(input_dir=input_dir)
  
          # dump the dataset in the output directory
          dataset.dump(output_dir, filenames_tag)
  
file_path: lightly/lightly/cli/download_cli.py
imports: import os
  import hydra
  import lightly.data
  from lightly.api.api_workflow_client import ApiWorkflowClient
  from lightly.cli._helpers import cpu_count, fix_hydra_arguments, fix_input_path
  from lightly.openapi_generated.swagger_client.models import Creator
  from lightly.utils.hipify import bcolors, print_as_warning
label_desc: Use image node_id 1 for calling a global function with example usage: _download_cli(cfg, is_cli_call) without return types