'Perform a rough estimate by extrapolating number of lines from a small read.'

def estimate_file_lines(self, dataset):

    sample_size = 1048576
    dataset_fh = open(dataset.file_name)
    dataset_read = dataset_fh.read(sample_size)
    dataset_fh.close()
    sample_lines = dataset_read.count('\n')
    est_lines = int((sample_lines * (float(dataset.get_size()) / float(sample_size))))
    return est_lines
