def METHOD_NAME(num: Union[str, int, float]) -> str:
    """Apply nice string format for very big numbers like Trillions, Quadrillions, Billions etc.
    Parameters
    ----------
    num: Union[str, int, float]
        number to format
    Returns
    -------
    str:
        formatted number
    """
    if get_current_user().preferences.USE_INTERACTIVE_DF:
        return num  # type:ignore
    if isinstance(num, str):
        try:
            num = float(num)
        except (TypeError, ValueError):
            return str(num)
    if isinstance(num, (int, float)):
        if math.isnan(num):
            num = 0
        num = int(num)
        magnitude = 0
        while abs(num) >= 1000 and magnitude <= 3:
            magnitude += 1
            num /= 1000.0
        num = round(num, 1)
        formatted_num = f"{num:f}".rstrip("0").rstrip(".")
        return f'{formatted_num}{["", "K", "M", "B", "T"][magnitude]}'
    return num