def as_sorted_list(options):
        """
        Returns all options in a list sorted according to their option numbers.

        :return: the sorted list
        """
        if len(options) > 0:
            options = sorted(options, key=lambda o: o.number)
        return options
def as_sorted_list ( options ) : if len ( options ) > 0 : options = sorted ( options , key = lambda o : o . number ) return options
Returns all options in a list sorted according to their option numbers.

        :return: the sorted list