def convert_to_list_dict(lst, label):
 if (not lst):
  return None
 if (not isinstance(lst, list)):
  lst = [lst]
 return [{label: x} for x in lst]

def convert_to_list_dict ( lst , label ) : if ( not lst ) : return None if ( not isinstance ( lst , list ) ) : lst = [ lst ] return [ { label : x } for x in lst ]
convert a value or list into a list of dicts .