def METHOD_NAME(accession_code: str, attributes: List, source: Contribution):
    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)
        )
        return
    for attribute in attributes:
        if type(attribute) != dict:
            logger.error(
                "An observation for sample '{}' is of type '{}', not dict. Skipping...".format(
                    accession_code, type(attribute)
                )
            )
            continue
        for name, value in attribute.items():
            # We want importing sample attributes to be idempotent, so if an
            # attribute with the same submitter and name already exists, let's
            # update that instead.
            #
            # NOTE: Are there any situations where a sample could have multiple
            # attributes with the same ontology term name?
            try:
                attribute = SampleAttribute.objects.get(
                    sample=sample, source=source, name__ontology_term=name
                )
            except SampleAttribute.DoesNotExist:
                attribute = SampleAttribute()
                attribute.sample = sample
                attribute.source = source
                attribute.name = OntologyTerm.get_or_create_from_api(name)
            attribute.set_value(value["value"])
            probability = value.get("probability", None)
            if probability is not None:
                attribute.probability = probability
            unit = value.get("unit", None)
            if unit is not None:
                attribute.unit = OntologyTerm.get_or_create_from_api(unit)
            attribute.save()