def __init__(self, records, fuel_type, unit_name,
            record_type="interval", freq=None, pulse_value=None, name=None,
            data=None, estimated=None):

        # verify and save unit name
        if unit_name in self.UNITS:
            self.unit_name = self.UNITS[unit_name]["target_unit"]

            # we'll need this later to convert to the proper units.
            multiplier = self.UNITS[unit_name]["multiplier"]
        else:
            message = 'Unsupported unit name: "{}".'.format(unit_name)
            raise ValueError(message)


        # verify and save fuel type
        if fuel_type not in ["electricity", "natural_gas", "fuel_oil",
                "propane", "liquid_propane", "kerosene", "diesel",
                "fuel_cell"]:
            message = 'Unsupported fuel type: "{}".'.format(fuel_type)
            raise ValueError(message)
        else:
            self.fuel_type = fuel_type

        # set misc attributes
        self.freq = freq
        self.pulse_value = pulse_value
        self.name = name

        # import data directly (skipping record parsing) if available.
        if data is not None:
            if not records is None:
                message = "Please provide either data or records, but not both."
                raise ValueError(message)
            if estimated is None:
                message = "Please provide the the `estimated` attribute," \
                        " which contains boolean values indicating whether" \
                        " or not the data is estimated. Should have the same" \
                        " index as `data`"
                raise ValueError(message)
            self.data = data
            self.estimated = estimated

            # set frequency, if supplied.
            if freq is None:
                self.freq_timedelta = None
            elif freq[-1] not in ["D","H","T","S"]:
                # Improper configuration
                message = 'Invalid frequency specification: "{}".'.format(freq)
                raise ValueError(message)
            else:
                try:
                    dummy_start_date = datetime(1970,1,1,tzinfo=pytz.utc)
                    dummy_date_range = pd.date_range(dummy_start_date,
                            periods=2, freq=freq)
                    freq_timedelta = dummy_date_range[1] - dummy_date_range[0]
                except ValueError:
                    message = 'Invalid frequency specification: "{}".'\
                            .format(freq)
                    raise ValueError(message)
                self.freq_timedelta = freq_timedelta
            return

        # import records
        if "interval" == record_type:
            if freq is None or freq[-1] not in ["D","H","T","S"]:
                # Improper configuration
                message = 'Invalid frequency specification: "{}".'.format(freq)
                raise ValueError(message)
            else:
                try:
                    dummy_start_date = datetime(1970,1,1,tzinfo=pytz.utc)
                    dummy_date_range = pd.date_range(dummy_start_date,
                            periods=2, freq=freq)
                    freq_timedelta = dummy_date_range[1] - dummy_date_range[0]
                except ValueError:
                    message = 'Invalid frequency specification: "{}".'\
                            .format(freq)
                    raise ValueError(message)
            self.freq_timedelta = freq_timedelta
            self.data, self.estimated = self._import_interval(records)
        elif record_type in ["arbitrary", "billing"]:
            self.freq_timedelta = None
            self.data, self.estimated = self._import_arbitrary(records)
        elif record_type in ["arbitrary_start", "billing_start"]:
            self.freq_timedelta = None
            self.data, self.estimated = self._import_arbitrary_start(records)
        elif record_type in ["arbitrary_end", "billing_end"]:
            self.freq_timedelta = None
            self.data, self.estimated = self._import_arbitrary_end(records)
        elif "pulse" == record_type:
            if pulse_value is None or pulse_value <= 0:
                # incorrectly configured
                message = 'Expected pulse_value to be a positive float, '\
                        'but got {} instead.'.format(pulse_value)
                raise ValueError(message)
            self.freq_timedelta = None
            self.data, self.estimated = self._import_pulse(records)
        else:
            message('Invalid record_type: "{}".'.format(record_type))
            raise ValueError

        # convert units, as necessary
        self.data *= multiplier
dataset/ETHPy150Open impactlab/eemeter/eemeter/consumption.py/ConsumptionData.__init__/original