code: def get_q_home(env):
      
      q_home = env.get('QHOME')
      if q_home:
          return q_home
      for v in ['VIRTUAL_ENV', 'HOME']:
          prefix = env.get(v)
          if prefix:
              q_home = os.path.join(prefix, 'q')
              if os.path.isdir(q_home):
                  return q_home
      if WINDOWS:
          q_home = os.path.join(env['SystemDrive'], r'\q')
          if os.path.isdir(q_home):
              return q_home
      raise RuntimeError('No suitable QHOME.')
docs: Derive q home from the environment