def _flatten(fn):
    """Flatten the portfoliolines before calling the wrapped function."""

    def wrapper(*pflines):
        pflines = [pfl.flatten() for pfl in pflines]
        return fn(*pflines)

    return wrapper