def findShortestPath(graph, start, end, path=[]):
    """
    This function finds a shortest path from 'start' to 'end' on a graph
    This function is obtained from https://www.python.org/doc/essays/graphs/
    with one change due to the deprecation of the method has_key().
    
    Input: A graph ('graph'), a starting node ('start'), an end node ('end') and an empty path ('path')
    Output: Returns a shortest path from 'start' and 'end'.
    """
    
    path = path + [start]
    if start == end:
        return path
#    if not graph.has_key(start):
    if not (start in graph):
        return None
    shortestPath = None
    for node in graph[start]:
        if node not in path:
            newpath = findShortestPath(graph, node, end, path)
            if newpath:
                if not shortestPath or len(newpath) < len(shortestPath):
                    shortestPath = newpath

    #print(shortestPath)
    return shortestPath