For older versions of Python (before 3.6):
Using future-fstrings:
pip install future-fstrings
you have to place a special line at the top of your code:
coding: future_fstrings
Hence in your case:
-*- coding: future_fstrings -*- # should work even without -*-
# rest of the code
location = fromstr(f'POINT({longitude} {latitude})', srid=4326)