<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _parse_resource(self, resource):
 """ Ensure compliance with the spec's resource objects section :param resource: dict JSON API resource object """


        link = 'jsonapi.org/format/#document-resource-objects'
        rid = isinstance(resource.get('id'), unicode)
        rtype = isinstance(resource.get('type'), unicode)

        if not rtype or (self.req.is_patching and not rid):
            self.fail('JSON API requires that every resource object MUST '
                      'contain a `type` top-level key. Additionally, when '
                      'modifying an existing resource object an `id` '
                      'top-level key is required. The values of both keys '
                      'MUST be strings. Your request did not comply with '
                      'one or more of these 3 rules', link)
        elif 'attributes' not in resource and 'relationships' not in resource:
            self.fail('Modifiying or creating resources require at minimum '
                      'an attributes object and/or relationship object.', link)
        elif rid and self.req.is_posting:
            abort(exceptions.ModificationDenied(**{
                'detail': 'Our API does not support client-generated ID\'s '
                          'when creating NEW resources. Instead, our API '
                          'will generate one for you & return it in the '
                          'response.',
                'links': 'jsonapi.org/format/#crud-creating-client-ids',
            }))