<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_instance(self, service_name):
 """ Retrieves a service instance with the given name. """

        for resource in self.space._get_instances():
            if resource['entity']['name'] == service_name:
                return resource['entity']