def parse(fasta):
    """Parse an open FASTA file for sequences.

    For example, given a FASTA file `fasta.faa` containing:

    ::
        >sequence
        ACGTACGTACGT

    This file can be parsed:

    >>> with open('fasta.faa') as handle:
    ...     parse_fasta(handle)
    {"sequence": "ACGTACGTACGT"}

    Parameters
    ----------
    fasta : str
        Either an open file handle of a FASTA file, or newline split string (e.g. read
        in via readlines()) that can be iterated over.

    Returns
    -------
    sequences : dict
        Sequences in the FASTA file, keyed on sequence headers.
    """
    sequences = {}
    for line in fasta:
        try:
            line = line.decode().strip()
        except AttributeError:
            line = line.strip()
        if line.startswith('>'):
            header = line[1:]
            sequences[header] = ''
        else:
            sequences[header] += line
    return sequences
