def _chunked_bulk_create(django_model_object, unsaved_models, chunk_size=None):
if chunk_size is None:<EOL><INDENT>chunk_size = getattr(settings, '<STR_LIT>', <NUM_LIT:50>)<EOL><DEDENT>for i in range(<NUM_LIT:0>, len(unsaved_models), chunk_size):<EOL><INDENT>try:<EOL><INDENT>django_model_object.objects.bulk_create(unsaved_models[i:i + chunk_size])<EOL><DEDENT>except Exception as e:<EOL><INDENT>chunk_data = unsaved_models[i:i + chunk_size]<EOL>e.petl_chunk_data = chunk_data<EOL>raise e<EOL><DEDENT><DEDENT>
Create new models using bulk_create in batches of `chunk_size`.
    This is designed to overcome a query size limitation in some databases