Is there any standard pattern recognition algorithm in predicting an item which a user will be buying next, given I have the history of the purchases
Take a look at association rule learning (https://en.wikipedia.org/wiki/Association_rule_learning). A really common algorithm is the Apriori agorithm. You could use the package apyori, it works great: https://pypi.python.org/pypi/apyori/1.1.1

Generate association rules over all items bought by a user, not in a single transaction/purchase.