input: 
  from typing import Optional
  
  def read_url(url: str) -> Optional[str]:
      """
      Read the contents from a given URL.
      If the request is successful (status code 200), return the content as a string;
      otherwise, return None.
  
      >>> read_url("https://api.github.com/")
      '<!DOCTYPE html>\n<html lang="en">\n...'
      >>> read_url("https://nonexistentwebsite.com/")
      None
      """
      
      import requests
      
      try:
          r = requests.get(url)
          if r.status_code == 200:
              return r.text
          else:
              return None
      except requests.RequestException:
          return None
  
  
output:     import requests
      
      try:
          r = requests.get(url)
          if r.status_code == 200:
              return r.text
          else:
              return None
      except requests.RequestException:
          return None