<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Add a layer to a Map
Login to your ArcGIS Organization and hide the password with the getpass module. The API represents a GIS portal using the GIS class from the gis module. Instantiate your own GIS portal with this class and use its properties property (the Property Manager object accessed as a property) to access various information. You can also use the User Manager helper class by accessing the users property of the gis class to work with user infromation.
Step1:  Load a map widget from the gis class
For more information on IPython.display, refer to IPython's Rich Display System. Importing the diplay function allows for display of Item html and other graphic representations of objects.
Be sure to set your map to a variable for referencing later in the notebook.
Step2:  Use the Content Manager to access data in your portal.
Access the Content Manager with the content property of the gis class. The content object that results contains methods for working with the items in the gis portal.
The search method of the content object allows you to invesigate data you have access to (as determined by the authorization of the currently logged in user.) The search method has various parameters. Find out about the various parameters in the Content Manager help.  Below we'll return a list of all the Feature Service items in a portal with the word 'Church' in the title by using a wildcard for the query parameter, Feature Service for the item_type parameter. Set the max_items parameter to control the number of results returned.
Step3:  Correct results from API functions require input of specific formats, so it's important to know what types of objects are returned from queries. The Search method on the Content Manager returns a Python list of ArcGIS Items. Accessing members from a list and obtaining properties from items require knowing specific functions and methods. Typing an object, followed by a period, followed by a Tab provides access to properties and methods accessible from objects. 
The code below loops the list of Feature Service items to access the unique url to the feature service endpoint. This is a way to check the data and what format is returned from various queries.
Step4:  Use indexing to obtain the item from the list.
Step5:  Add the layer to the Map
The Map Widget's add_layer method requires an ArcGIS item as input. Type 
python
map.add_layer? 
and run the cell to inspect the help.
<ASSISTANT_TASK:>
Python Code:
from arcgis.gis import GIS
import getpass
password = getpass.getpass("Enter your ArcGIS Organizational Account Password: ")
gis = GIS("https://esrihax.maps.arcgis.com", "johnyHack", password)
print("Logged in successfully to {} as {}.".format(gis.properties.urlKey + '.' + gis.properties.customBaseUrl, \
                                                   gis.users.me.username))
Explanation: Add a layer to a Map
Login to your ArcGIS Organization and hide the password with the getpass module. The API represents a GIS portal using the GIS class from the gis module. Instantiate your own GIS portal with this class and use its properties property (the Property Manager object accessed as a property) to access various information. You can also use the User Manager helper class by accessing the users property of the gis class to work with user infromation.
End of explanation
from IPython.display import display
map = gis.map("Springfield, IL", 12)
map
Explanation: Load a map widget from the gis class
For more information on IPython.display, refer to IPython's Rich Display System. Importing the diplay function allows for display of Item html and other graphic representations of objects.
Be sure to set your map to a variable for referencing later in the notebook.
End of explanation
feat_services = gis.content.search(query="title:Church*", item_type="Feature Service", max_items=15)
print("{} has access to {} feature service items.".format(gis.users.me.username, len(feat_services)))
Explanation: Use the Content Manager to access data in your portal.
Access the Content Manager with the content property of the gis class. The content object that results contains methods for working with the items in the gis portal.
The search method of the content object allows you to invesigate data you have access to (as determined by the authorization of the currently logged in user.) The search method has various parameters. Find out about the various parameters in the Content Manager help.  Below we'll return a list of all the Feature Service items in a portal with the word 'Church' in the title by using a wildcard for the query parameter, Feature Service for the item_type parameter. Set the max_items parameter to control the number of results returned.
End of explanation
for feat_svc in feat_services:
    print("{} is a {}.".format(feat_svc.title.capitalize(), type(feat_svc)))
    print("\t{}".format(feat_svc.url))
Explanation: Correct results from API functions require input of specific formats, so it's important to know what types of objects are returned from queries. The Search method on the Content Manager returns a Python list of ArcGIS Items. Accessing members from a list and obtaining properties from items require knowing specific functions and methods. Typing an object, followed by a period, followed by a Tab provides access to properties and methods accessible from objects. 
The code below loops the list of Feature Service items to access the unique url to the feature service endpoint. This is a way to check the data and what format is returned from various queries.
End of explanation
churches_itm = [feat_services][0]
churches_itm
Explanation: Use indexing to obtain the item from the list.
End of explanation
map.add_layer(churches_itm)
Explanation: Add the layer to the Map
The Map Widget's add_layer method requires an ArcGIS item as input. Type 
python
map.add_layer? 
and run the cell to inspect the help.
End of explanation
<END_TASK>