'Override to add metadata as flattened keys on the serialized DatasetInstance.'

def serialize(self, dataset_assoc, keys, **context):

    KEYS_HANDLED_SEPARATELY = ('metadata',)
    left_to_handle = self._pluck_from_list(keys, KEYS_HANDLED_SEPARATELY)
    serialized = super(DatasetAssociationSerializer, self).serialize(dataset_assoc, keys, **context)
    if ('metadata' in left_to_handle):
        metadata = self._prefixed_metadata(dataset_assoc)
        serialized.update(metadata)
    return serialized
