<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def from_dict(self, document):
 """Create experiment object from JSON document retrieved from database. Parameters document : JSON Json document in database Returns ------- ExperimentHandle Handle for experiment object """

        identifier = str(document['_id'])
        active = document['active']
        timestamp = datetime.datetime.strptime(document['timestamp'], '%Y-%m-%dT%H:%M:%S.%f')
        properties = document['properties']
        subject_id = document['subject']
        image_group_id = document['images']
        fmri_data_id = document['fmri'] if 'fmri' in document else None
        return ExperimentHandle(
            identifier,
            properties,
            subject_id,
            image_group_id,
            fmri_data_id=fmri_data_id,
            timestamp=timestamp,
            is_active=active
        )