input: Write a function to generate a python program that reads the contents from a given URL and returns the content if the request is successful, otherwise returns None. If the input URL is invalid or the request fails, the function should return None.
  assert read_url("https://www.example.com")!==None
  assert read_url("https://invalidurl.com")==None
output: def read_url(url):
      try:
          import requests
          response = requests.get(url)
          if response.status_code == 200:
              return response.text
          else:
              return None
      except:
          return None