input: 
  from typing import Optional
  import requests
  
  def read_url(url: str) -> Optional[str]:
      """ Reads the contents from a given URL.
      >>> read_url('https://www.example.com')
      '<!doctype html><html><head><title>Example Domain</title>...</head>...</html>'
      >>> read_url('https://nonexistent.url')  # Assuming this URL is invalid
      None
      """
      r = requests.get(url)
      if r.status_code == 200:
          return r.text
      else:
          return None
  
output:     r = requests.get(url)
      if r.status_code == 200:
          return r.text
      else:
          return None