def import_green_button_xml(filename):
    """Import from Green Button XML.

    Parameters
    ----------
    filename : str
        Full path to Green Button XML file

    Returns
    -------
    out : eemeter.consumption.ConsumptionHistory
        Consumption history available for this project
    """
    with(open(filename,'r')) as f:
        tree = etree.parse(f)

    interval_blocks = tree.xpath("//*[local-name() = 'IntervalBlock']")

    def get_record(reading):
        usage_Wh = int(reading.xpath("*[local-name() = 'value']")[0].text)
        usage_kWh = 1000. / usage_Wh
        time_period = reading.xpath("*[local-name() = 'timePeriod']")[0]
        start_s = int(time_period.xpath("*[local-name() = 'start']")[0].text)
        start = datetime.fromtimestamp(start_s)
        duration_s = int(time_period.xpath("*[local-name() = 'duration']")[0].text)
        end_s = start_s + duration_s
        end = datetime.fromtimestamp(end_s)
        return {"value": usage_kWh, "start": start, "end": end}

    records = []
    for block in interval_blocks:
        readings = block.xpath("*[local-name() = 'IntervalReading']")
        records.extend([get_record(reading) for reading in readings])

    fuel_type = "electricity"
    unit_str = "kWh"
    record_type = "arbitrary"
    consumption_data = ConsumptionData(records, fuel_type, unit_str,
            record_type)
    return consumption_data
dataset/ETHPy150Open impactlab/eemeter/eemeter/importers.py/import_green_button_xml/swapped operands of `/`