def populate_data_sharing_consent(apps, schema_editor):
DataSharingConsent = apps.get_model('<STR_LIT>', '<STR_LIT>')<EOL>EnterpriseCourseEnrollment = apps.get_model('<STR_LIT>', '<STR_LIT>')<EOL>User = apps.get_model('<STR_LIT>', '<STR_LIT>')<EOL>for enrollment in EnterpriseCourseEnrollment.objects.all():<EOL><INDENT>user = User.objects.get(pk=enrollment.enterprise_customer_user.user_id)<EOL>data_sharing_consent, __ = DataSharingConsent.objects.get_or_create(<EOL>username=user.username,<EOL>enterprise_customer=enrollment.enterprise_customer_user.enterprise_customer,<EOL>course_id=enrollment.course_id,<EOL>)<EOL>if enrollment.consent_granted is not None:<EOL><INDENT>data_sharing_consent.granted = enrollment.consent_granted<EOL><DEDENT>else:<EOL><INDENT>consent_state = enrollment.enterprise_customer_user.data_sharing_consent.first()<EOL>if consent_state is not None:<EOL><INDENT>data_sharing_consent.granted = consent_state.state in ['<STR_LIT>', '<STR_LIT>']<EOL><DEDENT>else:<EOL><INDENT>data_sharing_consent.granted = False<EOL><DEDENT><DEDENT>data_sharing_consent.save()<EOL><DEDENT>
Populates the ``DataSharingConsent`` model with the ``enterprise`` application's consent data.

Consent data from the ``enterprise`` application come from the ``EnterpriseCourseEnrollment`` model.