def create(self, collection_name, obj):
        """
        Create a new object in the named collection.

        :param unicode collection_name: The name of the collection in which to
            create the object.

        :param IObject obj: A description of the object to create.

        :return _KubernetesState: A new state based on the current state but
            also containing ``obj``.
        """
        obj = self.agency.before_create(self, obj)
        new = self.agency.after_create(self, obj)
        updated = self.transform(
            [collection_name],
            lambda c: c.add(new),
        )
        return updated
def create ( self , collection_name , obj ) : obj = self . agency . before_create ( self , obj ) new = self . agency . after_create ( self , obj ) updated = self . transform ( [ collection_name ] , lambda c : c . add ( new ) , ) return updated
Create a new object in the named collection.

        :param unicode collection_name: The name of the collection in which to
            create the object.

        :param IObject obj: A description of the object to create.

        :return _KubernetesState: A new state based on the current state but
            also containing ``obj``.