<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Import the GIS module and other needed Python modules
The IPython.display module has some helper functions that the Python API takes advantage of for displaying objects like item details and maps in the notebook.
Step1:  Create the GIS object and point it to AGOL
Step2:  Test the connection
The output here is an example of the Python API taking advantage of IPython.display.
Step3:  Get the item that you want to update
Portals allows users to store and share a variety of items. Each item has a type, such as Web Map or Feature Service, and a set of type keywords that provide additional information on the characteristics of the type.
See Items and item types for more information.
Step4:  Update the metadata
<ASSISTANT_TASK:>
Python Code:
from arcgis.gis import GIS
from getpass import getpass
from IPython.display import display
Explanation: Import the GIS module and other needed Python modules
The IPython.display module has some helper functions that the Python API takes advantage of for displaying objects like item details and maps in the notebook.
End of explanation
# Get username and password
username = input('Username: ')
password = getpass(prompt='Password: ')
# Connect to portal
gis = GIS("https://arcgis.com/", username, password)
Explanation: Create the GIS object and point it to AGOL
End of explanation
user = gis.users.get(username)
user
Explanation: Test the connection
The output here is an example of the Python API taking advantage of IPython.display.
End of explanation
title = input("Feature class to search for: ")
items = gis.content.search(query="title:'" + title + "' AND owner:" + username, item_type="Feature Service")
print(type(items), len(items))
print(type(items[0]))
item = items[0]
item
item.tags
Explanation: Get the item that you want to update
Portals allows users to store and share a variety of items. Each item has a type, such as Web Map or Feature Service, and a set of type keywords that provide additional information on the characteristics of the type.
See Items and item types for more information.
End of explanation
# First set up some variables for input ot the *update* method.
thumbnail_path = "c:/temp/Hospitals.JPG"
tags = list(item.tags)
tags.append("health")
item_properties = {"snippet": "Location of Cambridge hospitals.",
                   "title": "Cambridge Hospitals",
                   "tags": ','.join(tags),
                   "accessinformation": "City of Cambridge GIS",
                   "licenseInfo": "License Info"
}
# Then perform the update
item.update(item_properties, thumbnail=thumbnail_path)
item
# Get the updated *item*
items[0].tags
Explanation: Update the metadata
End of explanation
<END_TASK>