if earliestDeparture.date() != latestDeparture.date():
            logger.error(
                " Error: Earliest and latest departure dates need to be the "
                " same date. If you're trying to search for round-trip "
                " flights, call this function for the outbound flight first, "
                " and then call again for the return flight. "
            )
            return [None]
        # Collect all results from the API
        try:
            response = client.shopping.flight_offers_search.get(
                originLocationCode=originLocationCode,
                destinationLocationCode=destinationLocationCode,
                departureDate=latestDeparture.strftime("%Y-%m-%d"),
                adults=1,
            )
        except ResponseError as error:
            print(error)
        # Generate output dictionary
        output = []
        for offer in response.data:
            itinerary: Dict = {}
            itinerary["price"] = {}
            itinerary["price"]["total"] = offer["price"]["total"]
            currency = offer["price"]["currency"]
            currency = response.result["dictionaries"]["currencies"][currency]
            itinerary["price"]["currency"] = {}
            itinerary["price"]["currency"] = currency
            segments = []
            for segment in offer["itineraries"][0]["segments"]:
                flight = {}
                flight["departure"] = segment["departure"]
                flight["arrival"] = segment["arrival"]
                flight["flightNumber"] = segment["number"]
                carrier = segment["carrierCode"]
                carrier = response.result["dictionaries"]["carriers"][carrier]
                flight["carrier"] = carrier
                segments.append(flight)
            itinerary["segments"] = []
            itinerary["segments"] = segments
            output.append(itinerary)
        # Filter out flights after latest departure time