@classmethod
    def from_dict(cls, payload_dict):
        '''Re-create object from dictionary'''

        prof = Profile.__new__(Profile)
        prof.payloads = []

        payload_dict_no_payloads = payload_dict.copy()

        if 'PayloadContent' in payload_dict_no_payloads:
            # remove any Payloads from the Profile's keys (they'll be added
            # as objects later)
            del payload_dict_no_payloads['PayloadContent']

        # give the object a payload so further functions will work
        prof.payload = payload_dict_no_payloads

        if 'PayloadContent' in payload_dict:
            for pld in payload_dict['PayloadContent']:
                # should load appropriate sub-class based on PayloadType
                new_pld = Payload.from_dict(pld)
                prof.append_payload(new_pld)

        return prof
dataset/ETHPy150Open jessepeterson/commandment/commandment/profiles/__init__.py/Profile.from_dict/original