Ensure compliance with the spec's relationships section

        Specifically, the relationships object of the single resource
        object. For modifications we only support relationships via
        the `data` key referred to as Resource Linkage.

        :param relationships:
            dict JSON API relationships object

def _parse_relationships(self, relationships):
        """ Ensure compliance with the spec's relationships section

        Specifically, the relationships object of the single resource
        object. For modifications we only support relationships via
        the `data` key referred to as Resource Linkage.

        :param relationships:
            dict JSON API relationships object
        """

        link = 'jsonapi.org/format/#document-resource-object-relationships'

        if not isinstance(relationships, dict):
            self.fail('The JSON API resource object relationships key MUST '
                      'be a hash & comply with the spec\'s resource linkage '
                      'section.', link)

        for key, val in relationships.items():
            if not isinstance(val, dict) or 'data' not in val:
                self.fail('Relationship key %s MUST be a hash & contain '
                          'a `data` field compliant with the spec\'s '
                          'resource linkage section.' % key, link)
            elif isinstance(val['data'], dict):
                data = val['data']
                rid = isinstance(data.get('id'), unicode)
                rtype = isinstance(data.get('type'), unicode)

                if not rid or not rtype:
                    self.fail('%s relationship\'s resource linkage MUST '
                              'contain `id` & `type` fields. Additionally, '
                              'they must both be strings.' % key, link)
            elif isinstance(val['data'], list):
                abort(exceptions.ModificationDenied(**{
                    'detail': 'Modifying the %s relationship or any to-many '
                              'relationships for that matter are is not '
                              'currently supported. Instead, modify the '
                              'to-one side directly.' % key,
                    'links': link,
                }))
            elif val['data']:
                self.fail('The relationship key %s is malformed & impossible '
                          'for us to understand your intentions. It MUST be '
                          'a hash & contain a `data` field compliant with '
                          'the spec\'s resource linkage section or null if '
                          'you want to unset the relationship.' % key, link)