import inspect

def debug(**kwargs):
    st = inspect.stack()[1]
print('%s:%d %s()' % (st[1], st[2], st[3]))
for k, v in list(kwargs.items()):
    print('%s = %s' % (k, v))

def f():
    a = 5
b = 8
debug(a=a, b=b)
f()
Printing names of variables passed to a function