def parse_spec(spec: str) ->dict:
    """
    Return a map of {"positive": [<examples>], "negative": [<examples>]}

    Examples:
        >>> parse_spec('''
        ... POSITIVE:
        ... ab
        ... abab
        ...
        ... NEGATIVE:
        ... ba
        ... baba
        ... ''')
        {'positive': ['ab', 'abab'], 'negative': ['ba', 'baba']}                
    """
    _, sep1, spec = spec.strip().partition('POSITIVE:\n')
    positive, sep2, negative = spec.strip().partition('NEGATIVE:\n')
    if not sep1 or not sep2:
        raise ValueError(
            'Spec does not contain a POSITIVE: and NEGATIVE: sections.')
    return {'positive': positive.strip().splitlines(), 'negative': negative
        .strip().splitlines()}
