def encode_name(name: str, encoding: str = "utf-8",
                replace: bool = True) -> str:
    """Used to encode names correctly for b2.

    Parameters
    ----------
    name : str
    encoding : str, optional
        by default "utf-8"
    replace : bool, optional
        by default True

    Returns
    -------
    str
    """

    if replace:
        name = name.replace(" ", "-")

    return name.encode(encoding).decode(encoding)