<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def nullity_sort(df, sort=None):
 """ Sorts a DataFrame according to its nullity, in either ascending or descending order. :param df: The DataFrame object being sorted. :param sort: The sorting method: either "ascending", "descending", or None (default). :return: The nullity-sorted DataFrame. """

    if sort == 'ascending':
        return df.iloc[np.argsort(df.count(axis='columns').values), :]
    elif sort == 'descending':
        return df.iloc[np.flipud(np.argsort(df.count(axis='columns').values)), :]
    else:
        return df