<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def reshuffle(expr, by=None, sort=None, ascending=True):
 """ Reshuffle data. :param expr: :param by: the sequence or scalar to shuffle by. RandomScalar as default :param sort: the sequence or scalar to sort. :param ascending: True if ascending else False :return: collection """


    by = by or RandomScalar()

    grouped = expr.groupby(by)
    if sort:
        grouped = grouped.sort_values(sort, ascending=ascending)

    return ReshuffledCollectionExpr(_input=grouped, _schema=expr._schema)