input: Write a function to install Python based on a given version number as a string. The function should create a Bash script that downloads, extracts, and installs the specified Python version. If the installation is successful, print the version number of the installed Python. If the installation fails, print "Installation failed". Ensure the function handles common errors such as network issues or unsupported versions.
  
  def install_python(version: str) -> None:
      with open("install_python.sh", "w") as f:
          f.write(f'''#!/bin/bash
  
  # Download specified version of Python
  curl -O https://www.python.org/ftp/python/{version}/Python-{version}.tgz
  
  # Extract the tgz file
  tar -xzf Python-{version}.tgz
  
  # Move into the Python directory
  cd Python-{version}
  
  # Run the configure script
  ./configure
  
  # Compile and install
  make
  if [ $? -eq 0 ]; then
      make install
      if [ $? -eq 0 ]; then
          echo {version}
      else
          echo "Installation failed"
      fi
  else
      echo "Installation failed"
  fi''')
      import subprocess
      subprocess.run(["bash", "install_python.sh"], check=True)
  
  assert install_python("3.8.5")=="3.8.5"
  assert install_python("3.9.0")=="3.9.0"
  assert install_python("3.7.0")=="3.7.0"
  assert install_python("4.0.0")=="Installation failed"
  assert install_python("3.8")=="Installation failed"
output: def install_python(version: str) -> None:
      with open("install_python.sh", "w") as f:
          f.write(f'''#!/bin/bash
  
  # Download specified version of Python
  curl -O https://www.python.org/ftp/python/{version}/Python-{version}.tgz
  
  # Extract the tgz file
  tar -xzf Python-{version}.tgz
  
  # Move into the Python directory
  cd Python-{version}
  
  # Run the configure script
  ./configure
  
  # Compile and install
  make
  if [ $? -eq 0 ]; then
      make install
      if [ $? -eq 0 ]; then
          echo {version}
      else
          echo "Installation failed"
      fi
  else
      echo "Installation failed"
  fi''')
      import subprocess
      try:
          subprocess.run(["bash", "install_python.sh"], check=True)
      except subprocess.CalledProcessError:
          print("Installation failed")