human
Complete this python program:
def GetCSVGeneratorFactory(kind, csv_filename, batch_size, csv_has_header, openfile=open, create_csv_reader=csv.reader):
assistant
#Here is the Python program you requested.

    """Return a factory that creates a CSV-based UploadWorkItem generator.
    Args:
    kind: The kind of the entities being uploaded.
    csv_filename: File on disk containing CSV data.
    batch_size: Maximum number of CSV rows to stash into an UploadWorkItem.
    csv_has_header: Whether to skip the first row of the CSV.
    openfile: Used for dependency injection.
    create_csv_reader: Used for dependency injection.
    Returns:
    A callable (accepting the Progress Queue and Progress Generators
    as input) which creates the UploadWorkItem generator.
    """
    loader = Loader.RegisteredLoader(kind)
    loader._Loader__openfile = openfile
    loader._Loader__create_csv_reader = create_csv_reader
    record_generator = loader.generate_records(csv_filename)
    def CreateGenerator(request_manager, progress_queue, progress_generator, unused_kinds):
        'Initialize    a    UploadWorkItem    generator.\n\n                Args:\n                        request_manager:    A    RequestManager    instance.\n                        progress_queue:    A    ProgressQueue    instance    to    send    progress    information.\n                        progress_generator:    A    generator    of    progress    information    or    None.\n                        unused_kinds:    The    kinds    being    generated    (ignored    in    this    method).\n\n                Returns:\n                        An    UploadWorkItemGenerator    instance.\n                '
        return UploadWorkItemGenerator(request_manager, progress_queue, progress_generator, record_generator, csv_has_header, batch_size)
    return CreateGenerator