def METHOD_NAME(self, spec_or_workflow, serializer):
    try:
        before = spec_or_workflow.METHOD_NAME(serializer)
        restored = spec_or_workflow.deserialize(serializer, before)
        after = restored.METHOD_NAME(serializer)
        return before, after
    except TaskNotSupportedError as exc:
        warnings.warn(f'Unsupported task spec: {exc}')
        return None, None