code: def _mount_nfs_uri(
      provider_uri, mount_path, auto_mount: bool = False
  ):
      LOG = get_module_logger("mount nfs", level=logging.INFO)
      if mount_path is None:
          raise ValueError(f"Invalid mount path: {mount_path}!")
      # FIXME: the C["provider_uri"] is modified in this function
      # If it is not modified, we can pass only  provider_uri or mount_path instead of C
      mount_command = "sudo mount.nfs %s %s" % (
          provider_uri,
          mount_path,
      )
      # If the provider uri looks like this 172.23.233.89//data/csdesign'
      # It will be a nfs path. The client provider will be used
      if not auto_mount:  # pylint: disable=R1702
          if not Path(mount_path).exists():
              raise FileNotFoundError(
                  f"Invalid mount path: {mount_path}! Please mount manually: {mount_command} or Set init parameter `auto_mount=True`"
              )
      else:
          # Judging system type
          sys_type = platform.system()
          if "windows" in sys_type.lower():
              # system: window
              exec_result = os.popen(
                  f"mount -o anon {provider_uri} {mount_path}"
              )
              result = exec_result.read()
              if "85" in result:
                  LOG.warning(
                      f"{provider_uri} on Windows:{mount_path} is already mounted"
                  )
              elif "53" in result:
                  raise OSError("not find network path")
              elif "error" in result or "错误" in result:
                  raise OSError("Invalid mount path")
              elif provider_uri in result:
                  LOG.info("window success mount..")
              else:
                  raise OSError(f"unknown error: {result}")
  
          else:
              # system: linux/Unix/Mac
              # check mount
              _remote_uri = (
                  provider_uri[:-1]
                  if provider_uri.endswith("/")
                  else provider_uri
              )
              # `mount a /b/c` is different from `mount a /b/c/`. So we convert it into string to make sure handling it accurately
              mount_path = str(mount_path)
              _mount_path = (
                  mount_path[:-1]
                  if mount_path.endswith("/")
                  else mount_path
              )
              _check_level_num = 2
              _is_mount = False
              while _check_level_num:
                  with subprocess.Popen(
                      'mount | grep "{}"'.format(_remote_uri),
                      shell=True,
                      stdout=subprocess.PIPE,
                      stderr=subprocess.STDOUT,
                  ) as shell_r:
                      _command_log = shell_r.stdout.readlines()
                  if len(_command_log) > 0:
                      for _c in _command_log:
                          _temp_mount = _c.decode("utf-8").split(" ")[2]
                          _temp_mount = (
                              _temp_mount[:-1]
                              if _temp_mount.endswith("/")
                              else _temp_mount
                          )
                          if _temp_mount == _mount_path:
                              _is_mount = True
                              break
                  if _is_mount:
                      break
                  _remote_uri = "/".join(_remote_uri.split("/")[:-1])
                  _mount_path = "/".join(_mount_path.split("/")[:-1])
                  _check_level_num -= 1
  
              if not _is_mount:
                  try:
                      Path(mount_path).mkdir(
                          parents=True, exist_ok=True
                      )
                  except Exception as e:
                      raise OSError(
                          f"Failed to create directory {mount_path}, please create {mount_path} manually!"
                      ) from e
  
                  # check nfs-common
                  command_res = os.popen("dpkg -l | grep nfs-common")
                  command_res = command_res.readlines()
                  if not command_res:
                      raise OSError(
                          "nfs-common is not found, please install it by execute: sudo apt install nfs-common"
                      )
                  # manually mount
                  command_status = os.system(mount_command)
                  if command_status == 256:
                      raise OSError(
                          f"mount {provider_uri} on {mount_path} error! Needs SUDO! Please mount manually: {mount_command}"
                      )
                  elif command_status == 32512:
                      # LOG.error("Command error")
                      raise OSError(
                          f"mount {provider_uri} on {mount_path} error! Command error"
                      )
                  elif command_status == 0:
                      LOG.info("Mount finished")
              else:
                  LOG.warning(
                      f"{_remote_uri} on {_mount_path} is already mounted"
                  )
  
file_path: qlib/qlib/__init__.py
imports: from pathlib import Path
  import os
  from typing import Union
  import yaml
  import logging
  import platform
  import subprocess
  from .log import get_module_logger
label_desc: Use image node_id 2 for calling a global function with example usage: _mount_nfs_uri(provider_uri, mount_path, auto_mount) without return types