<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Load the content from a website with urllib.request
In this example we use urllib.request to load the content from a website.
Step1:  Some sites will block request from urlib, so we set a custom 'User-Agent' header
to load the content from the remote site.
Step2:  Let's check the HTTP status and the message.
Step3:  We can check if a specific HTTP request header exists
Step4:  Now we can load the content from the website
<ASSISTANT_TASK:>
Python Code:
import urllib.request
Explanation: Load the content from a website with urllib.request
In this example we use urllib.request to load the content from a website.
End of explanation
url = 'https://medium.com/tag/machine-learning'
req = urllib.request.Request(url, headers={'User-Agent' : "Magic Browser"}) 
con = urllib.request.urlopen(req)
Explanation: Some sites will block request from urlib, so we set a custom 'User-Agent' header
to load the content from the remote site.
End of explanation
print(con.status, con.msg)
Explanation: Let's check the HTTP status and the message.
End of explanation
con.getheader('Content-Type')
Explanation: We can check if a specific HTTP request header exists
End of explanation
text = con.read()
text[:500]
Explanation: Now we can load the content from the website
End of explanation
<END_TASK>