def set_bulk_metadata(document, metadata_dictionary):
    document_type = document.document_type
    document_type_metadata_types = [
        document_type_metadata_type.metadata_type for document_type_metadata_type in document_type.metadata.all()
    ]

    for metadata_type_name, value in metadata_dictionary.items():
        metadata_type = MetadataType.objects.get(name=metadata_type_name)

        if document_type_metadata_types in metadata_type:
            DocumentMetadata.objects.get_or_create(
                document=document, metadata_type=metadata_type, value=value
            )
dataset/ETHPy150Open mayan-edms/mayan-edms/mayan/apps/metadata/api.py/set_bulk_metadata/swapped operands of `in`