code: def _scoped_package_name(node_task, package_name, node_scope):
      
  
      if not node_scope:
        return package_name
  
      scoped_package_name = package_name
      chunk = package_name.split('/', 1)
      if len(chunk) > 1 and chunk[0].startswith('@'):
        scoped_package_name = os.path.join('@{}'.format(node_scope), chunk[1:])
      else:
        scoped_package_name = os.path.join('@{}'.format(node_scope), package_name)
  
      node_task.context.log.debug(
        'Node package "{}" will be resolved with scope "{}".'.format(package_name, scoped_package_name))
      return scoped_package_name
docs: Apply a node_scope to the package name.
  
      Overrides any existing package_name if already in a scope
  
      :return: A package_name with prepended with a node scope via '@'