import itertools


def _get_common_prefix(list_of_strings):
    """
    Returns the longest common prefix among the set of strings.
    Helpful for finding a VBIS tag prefix.

    Args:
        list_of_strings (list of str): list of strings
    Returns:
        pfx (str): longest common prefix
    """
    # https://stackoverflow.com/questions/6718196/determine-prefix-from-a-set-of-similar-strings
    def all_same(x):
        return all(x[0] == y for y in x)

    char_tuples = zip(*list_of_strings)
    prefix_tuples = itertools.takewhile(all_same, char_tuples)
    return "".join(x[0] for x in prefix_tuples).strip("-")