<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_data(self):
 """ attempt to read measurements file in working directory. """

        meas_file = os.path.join(self.WD, 'magic_measurements.txt')
        if not os.path.isfile(meas_file):
            print("-I- No magic_measurements.txt file")
            return {}
        try:
            meas_data, file_type = pmag.magic_read(meas_file)
        except IOError:
            print("-I- No magic_measurements.txt file")
            return {}
        if file_type == 'bad_file':
            print("-E- ERROR: Can't read magic_measurements.txt file. File is corrupted.")

        old_specimen_name = ''
        #start_time = time.time()
        meas_name_list = [measurement.name for measurement in self.measurements]

        for rec in meas_data:
            # get citation information
            citation = rec.get('er_citation_names', 'This study')
            if 'This study' not in citation:
                citation = citation.strip() + ':This study'
            er_data = {'er_citation_names': citation}
            pmag_data = {'er_citation_names': 'This study'}
            specimen_name = rec["er_specimen_name"]
            # ignore measurement if there is no specimen
            if specimen_name == "" or specimen_name == " ":
                continue
            # if we've moved onto a new specimen, make sure a sample/site/location
            # exists for that specimen
            if specimen_name != old_specimen_name:
                sample_name = rec["er_sample_name"]
                site_name = rec["er_site_name"]
                location_name = rec["er_location_name"]

                # add items and parents
                location = self.find_by_name(location_name, self.locations)
                if location_name and not location:
                    location = self.add_location(location_name, er_data=er_data,
                                                 pmag_data=pmag_data)
                site = self.find_by_name(site_name, self.sites)
                if site_name and not site:
                    site = self.add_site(site_name, location_name,
                                         er_data, pmag_data)
                sample = self.find_by_name(sample_name, self.samples)
                if sample_name and not sample:
                    sample = self.add_sample(sample_name, site_name,
                                             er_data, pmag_data)
                specimen = self.find_by_name(specimen_name, self.specimens)
                if specimen_name and not specimen:
                    specimen = self.add_specimen(specimen_name, sample_name,
                                                 er_data, pmag_data)

                # add child_items
                if sample and not self.find_by_name(specimen_name, sample.specimens):
                    sample.specimens.append(specimen)
                if site and not self.find_by_name(sample_name, site.samples):
                    site.samples.append(sample)
                if location and not self.find_by_name(site_name, location.sites):
                    location.sites.append(site)

            exp_name = rec['magic_experiment_name']
            meas_num = rec['measurement_number']

            meas_name = exp_name + '_' + str(meas_num)
            measurement = self.find_by_name(meas_name, self.measurements, meas_name_list)
            if not measurement:
                self.add_measurement(exp_name, meas_num, specimen.name, rec)
                meas_name_list.append(meas_name)

            old_specimen_name = specimen_name