from typing import Sequence
import re


def parse_fvalues(fvalues: Sequence) -> frozenset:
    """
    Parse a sequence of fvalues as a frozenset.

    This function is mostly used for parsing string provided by the user,
    splitting them accordingly, but accepts any sequence type. If a string is
    passed, it will use different delimiters and guarantees that all methods will
    allow the same delimiters. Delimiters can be white spaces, commas, semicolons,
    forward slashes, and the " and " substring.

    @param fvalues: The sequence with the fvalues to be parsed.
    @return: A frozenset with the fvalues.
    """

    if isinstance(fvalues, str):
        # We internally convert everything to spaces
        for delimiter in [" and ", ",", ";", "/"]:
            fvalues = fvalues.replace(delimiter, " ")

        fvalues = re.sub(r"\s+", " ", fvalues.strip())
        fvalues = fvalues.split()

    return frozenset(fvalues)