input: Write a function to generate a Python program that reads the contents from a given URL. The function should accept the URL as input and return the content of the URL if the request is successful (status code 200), otherwise return None.
  
  assert read_url('https://www.example.com')!=None
  assert read_url('https://www.invalidurl.com')==None
output: import requests
  
  def read_url(url):
      try:
          response = requests.get(url)
          if response.status_code == 200:
              return response.text
          else:
              return None
      except requests.RequestException:
          return None