@staticmethod
def get_tag_context(match, limit=100, full_tag=False):
    """
        Get context of the tag match object.

        Returns a string with <limit> symbols before match, the match string and
        <limit> symbols after match.

        If full_tag == False, matched string is limited too: first <limit>/2
        symbols of match and last <limit>/2 symbols of match.
        """
    source = match.string
    start = max(0, match.start() - limit)
    end = min(len(source), match.end() + limit)
    span = match.span()
    result = '...' if start != 0 else ''
    if span[1] - span[0] > limit and not full_tag:
        bp1 = match.start() + limit // 2
        bp2 = match.end() - limit // 2
        result += f'{source[start:bp1]} <...> {source[bp2:end]}'
    else:
        result += source[start:end]
    if end != len(source):
        result += '...'
    return result
