def normalize()

in facebook_business/adobjects/serverside/custom_data.py [0:0]


    def normalize(self):
        normalized_payload = {
            'value': self.value,
            'currency': Normalize.normalize_field_skip_hashing('currency', self.currency),
            'content_name': self.content_name,
            'content_category': self.content_category,
            'content_ids': self.content_ids,
            'content_type': self.content_type,
            'order_id': self.order_id,
            'predicted_ltv': self.predicted_ltv,
            'num_items': self.num_items,
            'status': self.status,
            'search_string': self.search_string,
            'item_number': self.item_number,
        }

        if self.delivery_category is not None:
            normalized_payload['delivery_category'] = self.delivery_category.value

        if self.contents is not None:
            contents = []
            for content in self.contents:
                if content is not None:
                    contents.append(content.normalize())

            normalized_payload['contents'] = contents

        # Append the custom_properties to the custom_data normalized payload.
        if self.custom_properties:
            for key in self.custom_properties:
                if key in normalized_payload.keys():
                    raise Exception('Duplicate key in custom_properties:"' + key + '". Please make sure the keys defined in the custom_properties are not already available in standard custom_data property list.')
                normalized_payload[key] = self.custom_properties[key]

        normalized_payload = {k: v for k, v in normalized_payload.items() if v is not None}
        return normalized_payload