def locate(cls):
    """Locates the active PEX bootstrap.

    :rtype: :class:`Bootstrap`
    """
    if cls._INSTANCE is None:
      bootstrap_path = __file__
      module_import_path = __name__.split('.')

      # For example, our __file__ might be requests.pex/.bootstrap/pex/bootstrap.pyc and our import
      # path pex.bootstrap; so we walk back through all the module components of our import path to
      # find the base sys.path entry where we were found (requests.pex/.bootstrap in this example).
      for _ in module_import_path:
        bootstrap_path = os.path.dirname(bootstrap_path)

      cls._INSTANCE = cls(sys_path_entry=bootstrap_path)
    return cls._INSTANCE
Locates the active PEX bootstrap.

    :rtype: :class:`Bootstrap`