def synsets(lemma,pos=None):
    """Returns all synset objects which have lemma as one of the variant literals and fixed pos, if provided.

    Notes
    -----
    Uses lazy initialization - parses only those synsets which are not yet initialized, others are fetched from a dictionary.

    Parameters
    ----------
    lemma : str
      Lemma of the synset.
    pos : str, optional
      Part-of-speech specification of the searched synsets, defaults to None.

    Returns
    -------
    list of Synsets
      Synsets which contain `lemma` and of which part-of-speech is `pos`, if specified.
      Empty list, if no match was found.

    """

    def _get_synset_idxes(lemma,pos):
        line_prefix_regexp = "%s:%s:(.*)"%(lemma,pos if pos else "\w+") 
        line_prefix = re.compile(line_prefix_regexp)

        idxes = []

        with codecs.open(_LIT_POS_FILE,'rb', 'utf-8') as fin:
            for line in fin:
                result = line_prefix.match(line)
                if result:
                    res_indices = [int(x) for x in result.group(1).split(' ')]
                    idxes.extend(res_indices)
                    
        LEM_POS_2_SS_IDX[lemma][pos].extend(idxes)
        return sorted(idxes)

    synset_idxes = None

    if lemma in LEM_POS_2_SS_IDX:
        if pos in LEM_POS_2_SS_IDX[lemma]:
            synset_idxes = LEM_POS_2_SS_IDX[lemma][pos]
        else:
            synset_idxes = [idx for pos in LEM_POS_2_SS_IDX[lemma] for idx in LEM_POS_2_SS_IDX[lemma][pos]]
    if not synset_idxes:
        synset_idxes = _get_synset_idxes(lemma,pos)

    if len(synset_idxes) == 0:
        return []

    stored_synsets = [SYNSETS_DICT[synset_idxes[i]] for i in range(len(synset_idxes)) if synset_idxes[i] in SYNSETS_DICT]
    unstored_synset_idxes = [synset_idxes[i] for i in range(len(synset_idxes)) if synset_idxes[i] not in SYNSETS_DICT]

    synset_offsets = _get_synset_offsets(unstored_synset_idxes)
    synsets = _get_synsets(synset_offsets)
    
    return stored_synsets + synsets
Returns all synset objects which have lemma as one of the variant literals and fixed pos, if provided.

    Notes
    -----
    Uses lazy initialization - parses only those synsets which are not yet initialized, others are fetched from a dictionary.

    Parameters
    ----------
    lemma : str
      Lemma of the synset.
    pos : str, optional
      Part-of-speech specification of the searched synsets, defaults to None.

    Returns
    -------
    list of Synsets
      Synsets which contain `lemma` and of which part-of-speech is `pos`, if specified.
      Empty list, if no match was found.