code: def _download_with_cloud_storage_client(dpath, sample: bool = False):
      # Initiating the Cloud Storage Client with anonymous credentials
      stm = _import_google_cloud_client()
      storage_client = stm.Client.create_anonymous_client()
  
      def _download_blob(blob, target):
          with open(target, "wb") as fout:
              storage_client.download_blob_to_file(blob, fout)
  
      def _download_blobs_from_list(blobs_list, target_path):
          for blob in tqdm(blobs_list):
              cloud_storage_fname = blob.name.split("/")[-1]
              downloaded_fname = os.path.join(
                  target_path, cloud_storage_fname
              )
              _download_blob(blob, downloaded_fname)
  
      # Creating data storage directories
      for dtype in ("train", "valid"):
          os.makedirs(os.path.join(dpath, dtype), exist_ok=True)
  
      # Populating a list of train and valid dataset blobs to download
      train_blobs = []
      valid_blobs = []
      for blob in storage_client.list_blobs("natural_questions"):
          blob_name = blob.name
          if not blob_name.endswith(".gz"):  # Not a zipped file
              continue
  
          if sample and blob_name.startswith("v1.0/sample"):
              if "train" in blob_name:
                  train_blobs.append(blob)
              else:
                  valid_blobs.append(blob)
          elif not sample and blob_name.startswith("v1.0/train"):
              train_blobs.append(blob)
          elif not sample and blob_name.startswith("v1.0/dev"):
              valid_blobs.append(blob)
  
      # Downloading the blobs to their respective dtype directory
      logging.info("Downloading train data ...")
      _download_blobs_from_list(
          train_blobs, os.path.join(dpath, "train")
      )
      logging.info("Downloading valid data ...")
      _download_blobs_from_list(
          valid_blobs, os.path.join(dpath, "valid")
      )
  
file_path: ParlAI/parlai/tasks/natural_questions/build.py
imports: import os
  from tqdm import tqdm
  import parlai.core.build_data
  import parlai.utils.logging
label_desc: Use image node_id 2 for calling a global function with example usage: _download_with_cloud_storage_client(dpath, sample) without return types