def generate_dict(self):
        '''Assemble the profile dictionary including each added Payload

        A Profile uses the PayloadContent key to place the aggregated Payloads
        into. Thus a Profile cannot separately set a PayloadContent key. An
        exception will be raised if this has been done.'''

        if 'PayloadContent' in self.payload.keys():
            raise Exception('PayloadContent already exists on Profile payload')

        # avoid modifying our actual payload by using a shallow copy
        dict_copy = self.payload.copy()

        dict_copy['PayloadContent'] = []

        for payload in self.payloads:
            dict_copy['PayloadContent'].append(payload.generate_dict())

        return dict_copy
dataset/ETHPy150Open jessepeterson/commandment/commandment/profiles/__init__.py/Profile.generate_dict/original