<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def normalize(self, body):
 """ Invoke the JSON API normalizer Perform the following: * add the type as a rtype property * flatten the payload * add the id as a rid property ONLY if present We don't need to vet the inputs much because the Parser has already done all the work. :param body: the already vetted & parsed payload :return: normalized dict """


        resource = body['data']
        data = {'rtype': resource['type']}

        if 'attributes' in resource:
            attributes = resource['attributes']
            attributes = self._normalize_attributes(attributes)

            data.update(attributes)

        if 'relationships' in resource:
            relationships = resource['relationships']
            relationships = self._normalize_relationships(relationships)

            data.update(relationships)

        if resource.get('id'):
            data['rid'] = resource['id']

        return data