<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def flatten_func_grad(func):
 r""" Decorator to flatten structured gradients and return objective. Examples -------- True 2 (3,) () array([ 0.125, 0.025, -0.05 ]) True True array([ 0.125, 0.025, -0.05 , 0.15 ]) """

    @wraps(func)
    def new_func(*args, **kwargs):
        val, grad = func(*args, **kwargs)
        return val, flatten(grad, returns_shapes=False)

    return new_func