def __getitem__(self, attr):
        # If it's a folder, easy:
        if attr in self.foldernames:
            return self._get_subfolder(attr, Folder)
        elif attr in self.clusternames:
            return self._get_subfolder(attr, Folder)
        services = [x.copy() for x in self._json_struct['services']]
        # Strip out relative paths
        for service in services:
            service['name'] = service['name'].rstrip('/').split('/')[-1]
        # Handle the case of Folder_Name being potentially of Service_Type
        # format
        if '_' in attr: # May have a Name_Type service here
            al = attr.rstrip('/').split('/')[-1].split('_')
            servicetype = al.pop()
            untyped_attr = '_'.join(al)
            matchingservices = [svc for svc in services 
                                if svc['name'] == untyped_attr
                                and svc['type'] == servicetype]
            if len(matchingservices) == 1: 
                return self._get_subfolder("%s/%s/" % 
                    (untyped_attr, servicetype),
                    self._service_type_mapping.get(servicetype, Service))
        # Then match by service name
        matchingservices = [svc for svc in services if svc['name'] == attr]
        # Found more than one match, there is ambiguity so return an
        # object holding .ServiceType attributes representing each service.
        if len(matchingservices) > 1:
            # Return an instance with accessors for overlapping services
            class AmbiguousService(object):
                """This service name has multiple service types."""
            ambiguous = AmbiguousService()
            for svc in matchingservices:
                attr, servicetype = svc['name'], svc['type']
                service = self._get_subfolder("%s/%s/" % (attr, servicetype), 
                    self._service_type_mapping.get(servicetype, Service))
                setattr(ambiguous, servicetype, service)
            return ambiguous
        # Just one match, can return itself.
        elif len(matchingservices) == 1:
            servicetype = matchingservices[0]['type']
            return self._get_subfolder("%s/%s/" % (attr, servicetype), 
                self._service_type_mapping.get(servicetype, Service))
        raise AttributeError("No service or folder named %r found" % attr)

# A catalog root functions the same as a folder, so treat Catalog as just a
# special case of Folder
dataset/ETHPy150Open jasonbot/arcrest/arcrest/server.py/Folder.__getitem__/original