def METHOD_NAME(keywords: Dict, source: Contribution):
    dirty_experiments = set()
    for accession_code, keywords in keywords.items():
        if type(accession_code) != str:
            logger.error("The provided sample accession {} is not a string".format(accession_code))
            continue
        if type(keywords) != list:
            # Don't print sample_attributes itself because it could be massive
            logger.error("The provided keywords for sample {} is not a list".format(accession_code))
            continue
        try:
            sample = Sample.objects.get(accession_code=accession_code)
        except Sample.DoesNotExist:
            logger.debug(
                "Skipping metadata for sample {} that we don't know about".format(accession_code)
            )
            continue
        dirty_experiments |= set(sample.experiment_set.all())
        for keyword in keywords:
            SampleKeyword.objects.get_or_create(
                sample=sample,
                source=source,
                name=OntologyTerm.get_or_create_from_api(keyword),
            )
    for experiment in dirty_experiments:
        experiment.update_sample_metadata_fields()
        experiment.save()