code: def detect_conda_env_name():
      # if call on yarn app master, return empty string
      if os.environ.get("OnAppMaster", "False") == "True":
          return ""
      # This only works for anaconda3
      import subprocess
  
      pro = subprocess.Popen(
          ["conda", "info"],
          shell=True,
          stdout=subprocess.PIPE,
          stderr=subprocess.PIPE,
      )
      out, err = pro.communicate()
      out = out.decode("utf-8")
      err = err.decode("utf-8")
      errorcode = pro.returncode
      if 0 != errorcode:
          invalidInputError(
              False,
              err
              + "Cannot find conda info. Please verify your conda installation",
          )
      for line in out.split("\n"):
          item = line.split(":")
          if len(item) == 2:
              if item[0].strip() == "active environment":
                  return item[1].strip()
      # For anaconda2 or if any error occurs above
      python_location = detect_python_location()
      if "envs" in python_location:
          return python_location.split("/")[-3]
          invalidInputError(
              False,
              err
              + "Failed to detect the current conda environment. Please verify "
              "your conda installation and activate the env you want to use",
          )
  
imports: import glob
  from bigdl.dllib.utils.file_utils import Sample
  import numpy
  from pyspark.ml.linalg import DenseVector, SparseVector, VectorUDT
  import sys
  import os
  import re
  from bigdl.dllib.utils.log4Error import *
label_desc: Use image node_id 4 for calling a global function with example usage: detect_conda_env_name() and returns: str, python_location, item