def deserialize(self, value, attr=None, data=None):
        """Deserialize ``value``.

        :raise ValidationError: If the value is not type `dict`, if the
            value does not contain a `data` key, and if the value is
            required but unspecified.
        """
        if value is missing_:
            return super(Relationship, self).deserialize(value, attr, data)
        if not isinstance(value, dict) or 'data' not in value:
            # a relationships object does not need 'data' if 'links' is present
            if value and 'links' in value:
                return missing_
            else:
                raise ValidationError('Must include a `data` key')
        return super(Relationship, self).deserialize(value['data'], attr, data)