code: def get_home():
      
      path = ''
      try:
          path = os.path.expanduser("~")
      except:
          pass
      if not os.path.isdir(path):
          for evar in ('HOME', 'USERPROFILE', 'TMP'):
              try:
                  path = os.environ[evar]
                  if os.path.isdir(path):
                      break
              except:
                  pass
      if path:
          return path
      else:
          raise RuntimeError('please define environment variable $HOME')
docs: Find user's home directory if possible. Otherwise raise error.
  
      :return: user's home directory
      :rtype: :py:obj:`str`
  
      New in PyTango 7.1.4