code: def detect_inside_virtualenv(prefix, real_prefix, base_prefix):
      
      if real_prefix is not None:
          return True
  
      if base_prefix is None:
          return False
  
      # if prefix is different than base_prefix, it's a venv
      return prefix != base_prefix
docs: Tell if fades is running inside a virtualenv.
  
      The params 'real_prefix' and 'base_prefix' may be None.
  
      This is copied from pip code (slightly modified), see
  
          https://github.com/pypa/pip/blob/281eb61b09d87765d7c2b92f6982b3fe76ccb0af/
              pip/locations.py#L39