from typing import Union


def fibonacci(num: int, *, ret_text: bool = False) -> Union[list, str]:
    """
        Generates the sequence of Fibonacci

        >>> from snakypy import helpers
        >>> helpers.calcs.fibonacci(50)
        [0, 1, 1, 2, 3, 5, 8, 13, 21, 34]
        >>> helpers.calcs.fibonacci(50, ret_text=True)
        '0 1 1 2 3 5 8 13 21 34'

    Args:
        num (int):  It should pass a positive whole number than zero.

        ret_text (bool): If the TRUE option returns the form sequence in the opposite
                             case in the form of a list. Default: False

    Returns:
        Returns a list or a string depending on the value of the **ret_text**.
    """
    previous_, next_ = 0, 0
    fib = []
    while next_ < num:
        fib.append(next_)
        next_ = next_ + previous_
        previous_ = next_ - previous_
        if next_ == 0:
            next_ = next_ + 1
    if ret_text:
        return " ".join(str(n) for n in fib)
    return fib