from typing import Union


def compound_interest(
    capital: float,
    application_time: float,
    fess: float,
    *,
    ret_dict=False,
    ret_text=False,
) -> Union[tuple, dict, str]:
    """
        Function to apply compound interest.

        >>> from snakypy import helpers
        >>> helpers.calcs.compound_interest(2455, 12, 1)
        {'amount': 2766.36, 'fess': 311.36}
        >>> helpers.calcs.compound_interest(2455, 12, 1, ret_text=True)
        'The amount was: $ 2766.36. The fees were: $ 311.36.'

    Args:
        capital (float): Capital value

        application_time (float): Time if applications

        fess (float): Value fees

        ret_dict (bool): If it is True returns in the dictionary form

        ret_text (bool): If it is True returns in the dictionary text

    Returns:
        Returns dictionary or a string or both.
    """
    amount = capital * ((1 + fess / 100) ** application_time)
    fess_value = amount - capital
    format_text = f"The amount was: $ {amount:.2f}. The fees were: $ {fess_value:.2f}."
    format_dict = {"amount": float(f"{amount:.2f}"), "fess": float(f"{fess_value:.2f}")}
    if ret_dict and ret_text:
        return format_dict, format_text
    elif ret_text:
        return format_text
    elif ret_dict:
        return format_dict
    return format_dict