I have create a sample function where I want to pass all the keys in dict third_party to eval statement. Using itemgetter is not possible as dictionary key are variable.
def sample(third_party):
'''
:param third_party: is a dictionary number of keys and exact keys name varies
'''
#Types can be of multiple type, using if/else not possible
#type will always a key
tp_type = third_party['type']
if tp_type[-1] == 's':
type_execution = tp_type + '_s'
else:
type_execution = tp_type + 's'
#How to destructure dictionary into eval command as function arguments
eval_statement = "inital.constant.command" + type_execution + ".create("**third_party")"
eval(eval_statement)