

books_list = [
    {
        'id': 1,
        'title': 'Java How to Program',
        'author': 'Deitel & Deitel',
        'edition_year': 2007
    },
    {
        'id': 2,
        'title': 'Patterns of Enterprise Application Architeture',
        'author': 'Martin Fowler',
        'edition_year': 2002
    },
    {
        'id': 3,
        'title': 'Head First Design Patterns',
        'author': 'Elisabaeth Freeman',
        'edition_year': 2004
    },
    {
        'id': 4,
        'title': 'Internet & World Wide Web: How to Program',
        'author': 'Deithel & Deithel',
        'edition_year': 2007
    }
]


result = {'a': [3, 4, 1, 2],
          'b': [1, 4, 3, 2],
          'c': [4, 1, 3, 2],
          'd': None,  #  Raise an exception
          'e': []
}

ASCENDING = True
DESCENDING = False
