<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def create_services(self, compose_str: str) -> list: """Create new docker services. Args: compose_str (string):
 Docker compose 'file' string Return: service_names, list """

        # Raise an exception if we are not a manager
        if not self._manager:
            raise RuntimeError('Services can only be run on '
                               'swarm manager nodes')

        # Initialise empty list
        services_ids = []

        try:
            service_config = yaml.load(compose_str)

            # Deepcopy the service config
            service_list = copy.deepcopy(service_config)

            # Removing version and service from the dict
            service_config.pop('version')
            service_config.pop('services')

            for service_name in service_list['services']:
                service_exist = self._client.services.list(
                    filters={'name': service_name})
                if not service_exist:
                    service_config['name'] = service_name
                    service_spec = self._parse_services(
                        service_config, service_name, service_list)
                    created_service = self._client.services.create(
                        **service_spec)
                    service_id = created_service.short_id
                    LOG.debug('Service created: %s', service_id)
                    services_ids.append(service_id)
                else:
                    LOG.debug('Services already exists')

        except yaml.YAMLError as exc:
            print(exc)

        # Returning list of services created
        return services_ids