Auto-generate relative Xpaths




Is it possible to auto generate Xpaths for the elements in the webpage. For eg., Suppose I have three inputs fields and one button on a webpage. Currently i am getting the Xpaths of these fields from a .conf file. Now i am looking at option of auto-generating the Xpaths, If i provide the webpage url as input to the python script it should be able to generate all the relative Xpaths for these three input text fields. Is there any python module which auto generates Xpaths?or please suggest an approach to auto-generate Xpaths. Any help appreciated. Thanks