def restrict_dates(feed, dates):
    """
    Given a Feed and a date (YYYYMMDD string) or list of dates,
    coerce the date/dates into a list and drop the dates not in
    ``feed.get_dates()``, preserving the original order of ``dates``.
    Intended as a helper function.
    """
    # Coerce string to set
    if isinstance(dates, str):
        dates = [dates]

    # Restrict
    return [d for d in dates if d in feed.get_dates()]