<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _apply_st(self, doc_loader, **kwargs):
 """Run the UDF single-threaded, optionally with progress bar"""

        udf = self.udf_class(**self.udf_init_kwargs)

        # Run single-thread
        for doc in doc_loader:
            if self.pb is not None:
                self.pb.update(1)

            udf.session.add_all(y for y in udf.apply(doc, **kwargs))

        # Commit session and close progress bar if applicable
        udf.session.commit()