code: def nullity_sort(df, sort=None):
      
      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
docs: 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.