def create(self, **fields):
        """Creates a new resource in Redmine database and returns resource object on success"""
        if self.resource_class.query_create is None or self.resource_class.container_create is None:
            raise ResourceBadMethodError

        if not fields:
            raise ResourceNoFieldsProvidedError

        formatter = MemorizeFormatter()

        title = fields.get('title')
        if title is not None and is_unicode(title):
            fields['title'] = to_string(title)

        try:
            url = '{0}{1}'.format(self.redmine.url, formatter.format(self.resource_class.query_create, **fields))
        except KeyError as exception:
            raise ValidationError('{0} field is required'.format(exception))

        self.container = self.resource_class.container_one
        data = {self.resource_class.container_create: self.prepare_params(formatter.unused_kwargs)}

        if data[self.resource_class.container_create] in 'uploads':
            data['attachments'] = data[self.resource_class.container_create].pop('uploads')
            for index, attachment in enumerate(data['attachments']):
                data['attachments'][index]['token'] = self.redmine.upload(attachment.get('path', ''))

        # Almost all resources are created via POST method, but some
        # resources are created via PUT, so we should check for this
        try:
            response = self.redmine.request('post', url, data=data)
        except ResourceNotFoundError:
            response = self.redmine.request('put', url, data=data)

        try:
            resource = self.to_resource(response[self.container])
        except TypeError:
            raise ValidationError('Resource already exists')  # fix for repeated PUT requests

        self.params = formatter.used_kwargs
        self.url = '{0}{1}'.format(
            self.redmine.url,
            self.resource_class.query_one.format(resource.internal_id, **fields)
        )
        return resource
dataset/ETHPy150Open maxtepkeev/python-redmine/redmine/managers.py/ResourceManager.create/swapped operands of `in`