def show_venue(venue_id):
    current_time = get_current_time()
    error = False
    body = {}

    try:
        venue = Venue.query.get(venue_id)
        upcoming_shows = venue.shows.filter(
            Show.start_time > current_time).all()
        past_shows = venue.shows.filter(Show.start_time < current_time).all()
        upcoming_shows_data = []
        past_shows_data = []

        for show in upcoming_shows:
            artist_details = Show.get_artist_details(show, format_datetime)
            upcoming_shows_data.append(artist_details)

        for show in past_shows:
            artist_details = Show.get_artist_details(show, format_datetime)
            past_shows_data.append(artist_details)

        body = Venue.get_full_details(venue)
        body['past_shows'] = past_shows_data
        body['upcoming_shows'] = upcoming_shows_data
        body['past_shows_count'] = len(past_shows)
        body['upcoming_shows_count'] = len(upcoming_shows)
    except:
        error = True
        print(sys.exc_info())

    if error:
        not_found_error()
    else:
        return render_template('pages/show_venue.html', venue=body)