Google interview question

Write a beam search algorithm in python