<human>:  Give me a Python function to check if a URL is valid.
<bot>: Here is a Python function to check if a URL is valid

import urllib.request, urllib.parse, urllib.error

def is_valid_url(url):
  """Check if a url is valid"""
  if not url.startswith('http://'):
    return False
  if not url.endswith('/'):
    return False
  return True

# Enter the url
url = "http://www.python.org/"

# Calling the function
print((is_valid_url(url)))

#Example Output
# True

#Remember to inspect code for bugs.