from pathlib import Path


def fasta_to_dict(fasta: Path) -> dict:
    """ Extracts data from FASTA file into a dict, headers are keys and sequences are values """
    with open(str(fasta), "r") as f:
        contents = f.readlines()
    fasta_dict = {}
    header = ""
    for line in contents:
        line = line.strip()
        if line.startswith(">"):
            header = line.replace(">", "").split(" ")[0]
            fasta_dict[header] = ""
        else:
            fasta_dict[header] += line
    return fasta_dict