def generate_recent_history(history_model, visitor, amount):
    """
    Generates a recent history log based on the History Model intended.

    :param history_model: History model used.
    :param visitor: User's history logs to check
    :param amount: How much of the recent entries are needed (10 would specify the 10 most recent entries)
    """
    return history_model.query.filter_by(visitor=visitor).order_by(history_model.id.desc())[:amount]