import csv


def parse_estimated_coverage_stats(path_to_estimated_coverage_stats):
    """
    Args:
        path_to_total_bp (str):

    Returns:
        dict:
        For example:
          {
            'sample_id': "Sample-01"
            'total_bp': 300017980
            'estimated_genome_size': 5200000
            'estimated_depth_of_coverage': 57.7
          }
    """
    estimated_coverage_stats_fields = {
        'sample_id': lambda x: x,
        'total_bp': lambda x: int(x),
        'estimated_genome_size': lambda x: int(x),
        'estimated_depth_of_coverage': lambda x: float(x),
    }
    with open(path_to_estimated_coverage_stats, 'r') as f:
        reader = csv.DictReader(f, fieldnames=list(estimated_coverage_stats_fields), delimiter='\t')
        header = next(reader)
        data = next(reader)
        estimated_coverage_stats = {}
        for field_name, parse in estimated_coverage_stats_fields.items():
            estimated_coverage_stats[field_name] = parse(data[field_name])

    return estimated_coverage_stats