def get_flights_sorted_price(flights, reverse=False):
    """Return a list of flights sorted by price.

    Args:
        flights (list): list of flights, each flight is represented
            by a dictionary.
        reverse (bool, optional): defines the sorting order,
            by default to False - ascending, if True sort in descending order.

    Returns:
        list: a list of flights sorted by price.
    """
    return sorted(
        flights,
        key=lambda flight: float(flight['Price']['TicketPrice']),
        reverse=reverse,
    )