I don't have a code to show to you because I have no idea on how to start. The current target is to at least be able to create tokens from a file that contains some data eg:
file.txt
Name : Sid
data : Lazy Developer
%description
This is a packaging file
%install
Enter the location to install the package.
and the python code should be able to create the tokens from this file and then when required print the data based on the input.
if getData() is the function then
getData('name') should output "Sid" GetData('description') should give the text below it.