code: def main(args):
      # Download the data
      url = _URLS[args.dataset]
      file_hash = _URL_FILE_STATS[url]
      target_download_location = os.path.join(
          args.cache_path, os.path.basename(url)
      )
      download(url, target_download_location, sha1_hash=file_hash)
      if args.save_dir is None:
          save_dir = args.dataset
      else:
          save_dir = args.save_dir
      if not args.overwrite and os.path.exists(save_dir):
          print(
              "{} found, skip! Turn on --overwrite to force overwrite".format(
                  save_dir
              )
          )
      print(
          "Extract the data from {} into {}".format(
              target_download_location, save_dir
          )
      )
      if args.dataset == "lmd_full":
          with tarfile.open(target_download_location) as f:
  
              def is_within_directory(directory, target):
                  abs_directory = os.path.abspath(directory)
                  abs_target = os.path.abspath(target)
  
                  prefix = os.path.commonprefix(
                      [abs_directory, abs_target]
                  )
  
                  return prefix == abs_directory
  
              def safe_extract(
                  tar, path=".", members=None, *, numeric_owner=False
              ):
                  for member in tar.getmembers():
                      member_path = os.path.join(path, member.name)
                      if not is_within_directory(path, member_path):
                          raise Exception(
                              "Attempted Path Traversal in Tar File"
                          )
  
                  tar.extractall(
                      path, members, numeric_owner=numeric_owner
                  )
  
              safe_extract(f, save_dir)
      elif args.dataset == "lmd_matched":
          with tarfile.open(target_download_location) as f:
  
              def is_within_directory(directory, target):
                  abs_directory = os.path.abspath(directory)
                  abs_target = os.path.abspath(target)
  
                  prefix = os.path.commonprefix(
                      [abs_directory, abs_target]
                  )
  
                  return prefix == abs_directory
  
              def safe_extract(
                  tar, path=".", members=None, *, numeric_owner=False
              ):
                  for member in tar.getmembers():
                      member_path = os.path.join(path, member.name)
                      if not is_within_directory(path, member_path):
                          raise Exception(
                              "Attempted Path Traversal in Tar File"
                          )
  
                  tar.extractall(
                      path, members, numeric_owner=numeric_owner
                  )
  
              safe_extract(f, save_dir)
      elif args.dataset == "lmd_aligned":
          with tarfile.open(target_download_location) as f:
  
              def is_within_directory(directory, target):
                  abs_directory = os.path.abspath(directory)
                  abs_target = os.path.abspath(target)
  
                  prefix = os.path.commonprefix(
                      [abs_directory, abs_target]
                  )
  
                  return prefix == abs_directory
  
              def safe_extract(
                  tar, path=".", members=None, *, numeric_owner=False
              ):
                  for member in tar.getmembers():
                      member_path = os.path.join(path, member.name)
                      if not is_within_directory(path, member_path):
                          raise Exception(
                              "Attempted Path Traversal in Tar File"
                          )
  
                  tar.extractall(
                      path, members, numeric_owner=numeric_owner
                  )
  
              safe_extract(f, save_dir)
      elif args.dataset == "clean_midi":
          with tarfile.open(target_download_location) as f:
  
              def is_within_directory(directory, target):
                  abs_directory = os.path.abspath(directory)
                  abs_target = os.path.abspath(target)
  
                  prefix = os.path.commonprefix(
                      [abs_directory, abs_target]
                  )
  
                  return prefix == abs_directory
  
              def safe_extract(
                  tar, path=".", members=None, *, numeric_owner=False
              ):
                  for member in tar.getmembers():
                      member_path = os.path.join(path, member.name)
                      if not is_within_directory(path, member_path):
                          raise Exception(
                              "Attempted Path Traversal in Tar File"
                          )
  
                  tar.extractall(
                      path, members, numeric_owner=numeric_owner
                  )
  
              safe_extract(f, save_dir)
      elif args.dataset == "maestro_v1":
          with zipfile.ZipFile(target_download_location, "r") as fobj:
              fobj.extractall(save_dir)
      elif args.dataset == "maestro_v2":
          with zipfile.ZipFile(target_download_location, "r") as fobj:
              fobj.extractall(save_dir)
      elif args.dataset == "geocities":
          with zipfile.ZipFile(target_download_location, "r") as fobj:
              fobj.extractall(save_dir)
      else:
          raise NotImplementedError
  
file_path: gluon-nlp/scripts/datasets/music_generation/prepare_music_midi.py
imports: import argparse
  import os
  import tarfile
  from gluonnlp.base import get_data_home_dir
  from gluonnlp.utils.misc import download, load_checksum_stats
  import zipfile
label_desc: Use image node_id 2 for calling a global function with example usage: main(args) and returns: unknown, unknown, unknown, unknown