def readEpochLines(filename, header, epoch_start, epoch_end):
    """
    Read lines from collectd CSV file and return
    a list containing the lines that match the given time interval
    Arguments:
        filename: The path and name to the data file to be read
        header: Boolean describing if header should be included in the result
        epoch_start: The start epoch (timestamp) of the wanted timeframe
        epoch_end: The end epoch (timestamp) of the wanted timeframe
    Returns:
        a list containing the lines between the start and end epoch. 
    """
    line = ''
    output = list()
    with open(filename, 'r') as infile:
        if header:
            output.append(infile.readline()[:-1])
        else:
            infile.readline()
        """   
        line1 = infile.readline()
        line2 = infile.readline()
        epoch1 = float(line1.split(",", 1)[0])
        epoch2 = float(line2.split(",", 1)[0])
        step = (epoch2 - epoch1)
        epochdiff = epoch_start - epoch1
        if epochdiff > 0:
            infile.readlines(int(len(line1)*(epochdiff/(step + 1))))
        """
        while True:
            line = infile.readline()
            if len(line) == 0:
                break
            line = line[:-1]
            current_epoch = float(line.split(',', 1)[0])
            if current_epoch > epoch_end:
                break
            elif current_epoch >= epoch_start:
                output.append(line)
    return output
