code: def _download_and_link(
      resource_alias,
      resource_fullname,
      compatibility,
      pip_args,
      verbose,
  ):
      import sys
      from snips_nlu import __about__
      from snips_nlu.cli.link import link_resources
      from snips_nlu.cli.utils import (
          PrettyPrintLevel,
          get_resources_version,
          install_remote_package,
          pretty_print,
      )
      from snips_nlu.common.utils import get_package_path
  
      version = get_resources_version(
          resource_fullname, resource_alias, compatibility
      )
      url_tail = "{r}-{v}/{r}-{v}.tar.gz#egg={r}=={v}".format(
          r=resource_fullname, v=version
      )
      download_url = __about__.__download_url__ + "/" + url_tail
      exit_code = install_remote_package(download_url, pip_args)
      if exit_code != 0:
          sys.exit(exit_code)
      try:
          # Get package path here because link uses
          # pip.get_installed_distributions() to check if the resource is a
          # package, which fails if the resource was just installed via
          # subprocess
          package_path = get_package_path(resource_fullname)
          link_path, resources_dir = link_resources(
              resource_fullname,
              resource_alias,
              force=True,
              resources_path=package_path,
          )
          if verbose:
              pretty_print(
                  "%s --> %s" % (str(resources_dir), str(link_path)),
                  title="Linking successful",
                  level=PrettyPrintLevel.SUCCESS,
              )
      except OSError as e:  # pylint:disable=bare-except
          pretty_print(
              "Creating a shortcut link for '%s' didn't work: %s"
              % (resource_alias, repr(e)),
              title="The language resources were successfully downloaded, "
              "however linking failed.",
              level=PrettyPrintLevel.ERROR,
          )
  
file_path: snips-nlu/snips_nlu/cli/download.py
imports: from __future__ import print_function, unicode_literals
label_desc: Use image node_id 8 for calling a global function with example usage: _download_and_link(resource_alias, resource_fullname, compatibility, pip_args, verbose) without return types