def resolve_executable(self, executable: str) -> str:
        """
        If the given executable can be found in the bin_dir then return its absolute
        path. Otherwise return the input.
        """
        bin_dir = self.bin_dir()
        if bin_dir.joinpath(executable).is_file():
            return str(bin_dir.joinpath(executable))
        if self._is_windows:
            if bin_dir.joinpath(f"{executable}.com").is_file():
                return str(bin_dir.joinpath(f"{executable}.com"))
            if bin_dir.joinpath(f"{executable}.exe").is_file():
                return str(bin_dir.joinpath(f"{executable}.exe"))
            if bin_dir.joinpath(f"{executable}.bat").is_file():
                return str(bin_dir.joinpath(f"{executable}.bat"))
            return shutil.which(executable) or executable
        return executable

        If the given executable can be found in the bin_dir then return its absolute
        path. Otherwise return the input.
        
poethepoet/virtualenv.py