The referer passed into the generateToken call must be contained within the referer header passed in with each call. So if generate token is called with referer=acme.com all calls using it must have a HTTP Referer header that contains that string, for instance �??http://maps.acme.com/mypage.html�??. Browsers automatically set this to whatever page the call is coming from and this cannot be overridden.
If the token is requested and used from Python then you can set whatever you want, and just make sure that the calls made to the API contain the same Referer string as was used to get the token. It could be a url, a session id, or whatever.