code: def sort(m, reverse=False):
      
      ty = type(m)
      if ty == matrix:
          m = list(m)
      m = sorted(m, reverse=reverse)
      if ty == matrix:
          m = matrix(m)
      return m
docs: Return sorted m (default: ascending order)