input: Write a python function to create a list of Book objects and then sort them by year of publication.
  assert sort_books_by_year([Book("Title1", "Author1", 2000, "Genre1"), Book("Title2", "Author2", 1995, "Genre2")])[0].getYear() == 1995
  assert sort_books_by_year([Book("Title3", "Author3", 2010, "Genre3"), Book("Title4", "Author4", 2005, "Genre4")])[1].getTitle() == "Title3"
  assert sort_books_by_year([Book("Title5", "Author5", 2020, "Genre5"), Book("Title6", "Author6", 2015, "Genre6")])[0].getAuthor() == "Author6"
output: class Book:
      def __init__(self, title, author, year, genre):
          self.title = title
          self.author = author
          self.year = year
          self.genre = genre
      
      def getTitle(self):
          return self.title
      
      def getAuthor(self):
          return self.author
      
      def getYear(self):
          return self.year
      
      def getGenre(self):
          return self.genre
  
  def sort_books_by_year(books):
      return sorted(books, key=lambda book: book.getYear())