def extract_tags(lexicon):
    """Extract the set of all tags that are used in a lexicon.

    The input lexicon should be a dict:
      - lexicon = {wordform: {annotation: set(possible tags)}}
    """
    tags = set()
    for annotations in list(lexicon.values()):
        tags.update(*list(annotations.values()))
    return tags