from typing import Dict
from typing import Optional


def dict_to_str(data: Dict, sep: Optional[str] = " ") -> str:
    """Converts the given dictionary to a string separated by the given separator.

    Args:
        data (dict):    dict that needs to be transformed
        sep (str):     Separator to be used.

    Returns:
        (str)   string value of the given data.
    """
    rtn = ""
    for key, value in data.items():
        rtn += f"{key}={value};" if sep == ";" else f'{key}="{value}"{sep}'

    return rtn.rstrip(sep)