<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def returns_cumulative(returns, geometric=True, expanding=False):
 """ return the cumulative return Parameters returns : DataFrame or Series geometric : bool, default is True If True, geometrically link returns expanding : bool default is False If True, return expanding series/frame of returns If False, return the final value(s) """

    if expanding:
        if geometric:
            return (1. + returns).cumprod() - 1.
        else:
            return returns.cumsum()
    else:
        if geometric:
            return (1. + returns).prod() - 1.
        else:
            return returns.sum()