def arrange(df, *args, **kwargs):
    flat_args = [a for a in flatten(args)]
    series = [df[arg] if isinstance(arg, str) else
              df.iloc[:, arg] if isinstance(arg, int) else
              pd.Series(arg) for arg in flat_args]
    sorter = pd.concat(series, axis=1).reset_index(drop=True)
    sorter = sorter.sort_values(sorter.columns.tolist(), **kwargs)
    return df.iloc[sorter.index, :]