code: def create_pex(self, pex_info=None):
      
      relevant_targets = self.context.targets(
        lambda tgt: isinstance(tgt, (
          PythonDistribution, PythonRequirementLibrary, PythonTarget, Files)))
      with self.invalidated(relevant_targets) as invalidation_check:
  
        # If there are no relevant targets, we still go through the motions of resolving
        # an empty set of requirements, to prevent downstream tasks from having to check
        # for this special case.
        if invalidation_check.all_vts:
          target_set_id = VersionedTargetSet.from_versioned_targets(
            invalidation_check.all_vts).cache_key.hash
        else:
          target_set_id = 'no_targets'
  
        interpreter = self.context.products.get_data(PythonInterpreter)
        path = os.path.realpath(os.path.join(self.workdir, str(interpreter.identity), target_set_id))
  
        # Note that we check for the existence of the directory, instead of for invalid_vts,
        # to cover the empty case.
        if not os.path.isdir(path):
          pexes = [
            self.context.products.get_data(ResolveRequirements.REQUIREMENTS_PEX),
            self.context.products.get_data(GatherSources.PYTHON_SOURCES)
          ]
  
          if self.extra_requirements():
            extra_requirements_pex = self.resolve_requirement_strings(
              interpreter, self.extra_requirements())
            # Add the extra requirements first, so they take precedence over any colliding version
            # in the target set's dependency closure.
            pexes = [extra_requirements_pex] + pexes
          constraints = {constraint for rt in relevant_targets if is_python_target(rt)
                         for constraint in PythonSetup.global_instance().compatibility_or_constraints(rt)}
  
          with self.merged_pex(path, pex_info, interpreter, pexes, constraints) as builder:
            for extra_file in self.extra_files():
              extra_file.add_to(builder)
            builder.freeze()
  
      return PEX(path, interpreter)
docs: Returns a wrapped pex that "merges" the other pexes via PEX_PATH.