def retrieve_name(var):
    callers_local_vars = list(inspect.currentframe().f_back.f_locals.items())
return [var_name for var_name, var_val in callers_local_vars if var_val is var]
Getting the name of a variable as a string