import re


def parse_fasta(entry):
    """parse_fasta(entry) -> dict. entry is a string.

    Parse a string representation of a single FASTA entry into a dict.
    The returned dict has values for 'name' and 'sequence'."""
    if not entry.startswith('>'):
        raise TypeError("entry does not start with '>'")

    # the entry must include at least two lines (a label and a sequence)
    lines = re.split(r'[\r\n]+', entry)
    if len(lines) < 2:
        raise TypeError("entry needs at least two lines")

    # name is everything on the first line after the '>'
    name = lines.pop(0)[1:].strip()
    # sequence is the rest of the entry
    sequence = ''.join(lines)

    return {'name': name, 'sequence': sequence}