def count_headings(elements):
    """put a level to each heading.

    returns a dict mapping heading levels to heading chars.
    Here is an example:

    >>> import pprint
    >>> lst=[
    ...      ('=', 'This is a heading'),
    ...      '',
    ...      'a text follows',
    ...      'here',
    ...      '',
    ...      ('+', 'here is another heading'),
    ...      '',
    ...      'with some text'
    ...     ]
    >>> pprint.pprint(count_headings(lst))
    {'+': 2, '=': 1}
    """
    heading_chars = {}
    last_level = 1
    for l in elements:
        if isinstance(l, tuple):
            ch = l[0]
            level = heading_chars.get(ch)
            if level is None:
                heading_chars[ch] = last_level
                level = last_level
                last_level += 1
    return heading_chars
